ios - UITableHeaderView 使用 Autolayout 如何使内容自适应
阿神
阿神 2017-04-17 16:49:22
0
1
462

我想让内容自动填充 UITableHeaderView, 使得其高度能够随着内容的变化而变化。但是,如果我直接设置 UITableHeaderView 为 translatesAutoresizingMaskIntoConstraints = NO 会报错 "Assertion failure in -[UITableView layoutSublayersOfLayer:]"。 如果不设置改属性,约束布局会出错 “Unable to simultaneously satisfy constraints.” 该如何解决,或者有没有更好的实现目标的解决方案?谢谢。

阿神
阿神

闭关修行中......

全部回覆(1)
PHPzhong

更改內容之後呼叫setNeedLayout和layoutIfNeed,得到frame後view.frame = frame给tableView.tableHeaderView重新赋值这样tableView.tableHeaderView = view

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!