tableView
来源:互联网 发布:python 列表生成字典 编辑:程序博客网 时间:2024/05/16 12:08
iOS8 , 自动计算Cell高度
// 告诉tableView的真实高度是自动计算的,根据你的约束来计算
self.tableView.rowHeight = UITableViewAutomaticDimension;
// 告诉tableView所有cell的估计行高
self.tableView.estimatedRowHeight = 44
row 刷新
<span style="font-size:14px;">NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1inSection:0];[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];</span>
section 刷新
<span style="font-size:14px;">NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:0];[self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationNone];</span>
headerview黏性
<span style="font-size:14px;">#pragma mark - scrollView delegate//delete UItableview headerview黏性- (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView == self.tableView) { CGFloat sectionHeaderHeight = 10; if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } [self.view endEditing:YES];}</span>
//设置字母索引背景色为透明if ([self.tableView respondsToSelector:@selector(setSectionIndexColor:)]) {self.tableView.sectionIndexBackgroundColor = [UIColor clearColor];self.tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor];//设置字母索引文字颜色self.tableView.sectionIndexColor = DWDColorMain;}
解决ios8及以上分割线有边緣问题
// 解决ios8及以上 分割线有边緣问题-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; }}// 解决ios8及以上 分割线有边緣问题-(void)viewDidLayoutSubviews{ if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView setSeparatorInset:UIEdgeInsetsZero]; } if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { [self.tableView setLayoutMargins:UIEdgeInsetsZero]; }}
设置区头颜色
//设置区头颜色- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section{ UITableViewHeaderFooterView *v = (UITableViewHeaderFooterView *)view; v.backgroundView.backgroundColor = [UIColor blackColor];}
0 0
- TableView
- TableView
- tableview
- tableview
- tableview
- TableView
- TABLEVIEW
- tableView
- tableView
- TableView
- tableview
- tableview
- tableView
- tableView
- tableView
- tableView
- TableView
- tableview
- Leetcode Course Schedule II
- poj 1222 EXTENDED LIGHTS OUT (高斯消元)
- mtk平台hw_get_module分析
- SQL SERVER下非聚集索引引发的死锁问题
- 设计简单的后台管理的数据排序
- tableView
- jsp返回上一个页面并刷新
- 比对YYYY-MM-DD HH:MM:SS格式的日期与当前日期的时间间隔
- POJ 2446 Chessboard(匈牙利算法)
- 光照基础
- 网络加载等待层
- 【Hibernate框架】关联映射(一对多,多对一)
- UML类图几种关系的总结
- 烟花源代码