美文网首页
UITableView

UITableView

作者: 啊俊吖 | 来源:发表于2018-09-28 10:08 被阅读4次

1.让 UITableView 的 headerView跟随 cell一起滚动

//多个session 设置 UITableView 类型为 grouped 此时,cell 都被加了分割线  
let table = UITableView(frame: .zero, style: .grouped)
// 取出分割线
table.separatorStyle = .none

//单一session 建议将 headerView添加在UITableView 上
tableView.tableHeaderView=header

2. iOS 11 tableView刷新界面 上跳闪烁

// 在AppDelegate 内添加 修复 tableview刷新是上跳闪烁
        if #available(iOS 11.0, *) {
            UITableView.appearance().estimatedRowHeight = 0;
            UITableView.appearance().estimatedSectionFooterHeight = 0;
            UITableView.appearance().estimatedSectionHeaderHeight = 0;
            UITableView.appearance().contentInsetAdjustmentBehavior = .never
        }

3. iOS 11 scrollToRow 滚不到最后一行

/// 滚动不到底部
        tableView.estimatedRowHeight = 0
        tableView.estimatedSectionFooterHeight = 0
        tableView.estimatedSectionHeaderHeight = 0

相关文章

网友评论

      本文标题:UITableView

      本文链接:https://www.haomeiwen.com/subject/mlpuoftx.html