UITableView開發常用以及遇到的問題

UITableView局部刷新 刷新單個cell或section

    /*
     *  單個cell的刷新
     */
    //1.當前所要刷新的cell,傳入要刷新的 行數 和 組數
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
    //2.將indexPath添加到數組
    NSArray <NSIndexPath *> *indexPathArray = @[indexPath];
    //3.傳入數組,對當前cell進行刷新
    [tableView reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationAutomatic];
    
    /**
     *  單個Section的刷新
     */
    //1.傳入要刷新的組數
    NSIndexSet *indexSet=[[NSIndexSet alloc] initWithIndex:0];
    //2.傳入NSIndexSet進行刷新
    [tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];

修改分割線顏色

[tableView setSeparatorColor:[UIColor blueColor]];
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容