1谈秫、使用tableview的分界線绕沈,但是界面下面有一些沒有數(shù)據(jù)但是還是顯示了分界線
//隱藏多余cell
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
2良蛮、去掉navigationitem下面的陰影
self.navigationController.navigationBar.shadowImage = [UIImage new];
3、刪除cell
cell.discardClose = { currentCell in
let currentIndexPath = self.tableView .indexPath(for: currentCell)!
self.dataList.removeObject(at: currentIndexPath.row)
self.tableView.beginUpdates()
self.tableView.deleteRows(at: [currentIndexPath], with: .none)
self.tableView.endUpdates()
}
4然走、在 Cell 內(nèi)部獲取父控制器
在 Cell 內(nèi)部獲取父控制器援制,在 Cell 內(nèi)部調(diào)用控制器的一些耦合性比較小的代碼,一定程度上也能達(dá)到瘦身的目的芍瑞。如在 Cell 中有個(gè)返回按鈕晨仑,需要當(dāng)前父視圖控制器返回 Push 到它之前的控制器,那么就需要在自定義 Cell 中拿到當(dāng)前的父視圖控制器做 Pop 操作拆檬。
- (UIViewController *)viewController {
for (UIView* next = [self superview]; next; next = next.superview) {
UIResponder *nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)nextResponder;
}
}
return nil;
}
簡(jiǎn)單方法
UITableView *tableView = (UITableView *) self.superview;
UIViewController *superController = (UIViewController *)tableView.dataSource;
5洪己、使用tableview estimatedRowHeight 自適應(yīng)高速度時(shí)刷新跳動(dòng)解決方案
[UIView performWithoutAnimation:^{
[weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
}];
6、局部刷新的問(wèn)題
tableview.beginUpdates()
tableview.reloadRows(at: tableview.indexPathsForVisibleRows!, with: .none)
tableview.endUpdates()