if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never
}else {
automaticallyAdjustsScrollViewInsets = false
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView == self.tableView {
if scrollView.contentOffset.y <= sectionHeaderHeight && scrollView.contentOffset.y >= 0 {
scrollView.contentInset = UIEdgeInsets(top: -scrollView.contentOffset.y, left: 0, bottom: 0, right: 0)
}else if scrollView.contentOffset.y >= sectionHeaderHeight {
scrollView.contentInset = UIEdgeInsets(top: -(sectionHeaderHeight), left: 0, bottom: 0, right: 0)
}
}
}
UITableView解决plain样式header悬停的方案
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 应用情景 情景一: 说明:是不是和tableView的Plain类型一样,其实这个是由两个列表实现的 情景二: 说...
- 让UITableView的section header view不悬停的方法 当UITableView的style...
- UITableView的section header view 不悬停的方法把 UITableView 的 sty...
- 当 UITableView 的 style 属性设置为 Plain 时,这个tableview的sectio...
- 当UITableView的style属性设置为Plain时,这个tableview的section header在...