UITableView

2018-09-28  本文已影响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
上一篇 下一篇

猜你喜欢

热点阅读