iOS处理UITableView的HeaderSection悬停和取消

问题

网络有很多UITableView的HeaderSection悬停和取消方法,我试用感觉还是存在问题!设计师喜欢用UITableViewStylePlain的样式来处理背景颜色[UIColor groupTableViewBackgroundColor]

解决

现在就设置取消悬停的处理方法,不一定是最好,我觉得这个应该是可行的,FooterInSectionHeaderInSection那个代理自己决定~

  1. 设置style:UITableViewStyleGrouped

  2. - (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section的代理方法中自定义View,是否重用自己考虑;

- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = [UIColor whiteColor];
    return footerView;
}
  1. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section的代理方法设置对于的高度;
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 20;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、简介 <<UITableView(或简单地说,表视图)的一个实例是用于显示和编辑分层列出的信息的一种手段 <<...
    无邪8阅读 10,674评论 3 3
  • 概述在iOS开发中UITableView可以说是使用最广泛的控件,我们平时使用的软件中到处都可以看到它的影子,类似...
    liudhkk阅读 9,086评论 3 38
  • 版权声明:未经本人允许,禁止转载. 1. TableView初始化 1.UITableView有两种风格:UITa...
    萧雪痕阅读 2,918评论 2 10
  • #pragma mark someValueAboutTableView 1.tableView的样式:UITab...
    潇岩阅读 956评论 0 0
  • 序引 本系列文章将介绍iOS开发中的UITableView控件,将会分成四篇文章完整的讲述UITableView的...
    yetCode阅读 2,291评论 3 40