美文网首页程序员iOS Developer
iOS UITableView Header 不悬停的tip

iOS UITableView Header 不悬停的tip

作者: 小峰书 | 来源:发表于2017-04-21 17:37 被阅读295次

UITableView Header 不悬停的tips之一

也可以关注我的个人博客

利用contentInset向上偏移去阻断系统悬停的计算位置,我们可以设置tableHeaderView的高度与sectionHeaderHeight高度一致

   let headerView = UIView(frame: CGRect(x: 0, y: 0, width: 375, height: 10.0))
   tableView.tableHeaderView = headerView
   tableView.contentInset.top = -10.0
   
   //设置sectionHeaderHeight
   
   override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 10
   }
        

相关文章

网友评论

    本文标题:iOS UITableView Header 不悬停的tip

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