ios - 缺少将 view.top 与动态高度 uilabel 底部连接的约束
问题描述
我正在尝试安排 3 个视图 - 1. 具有固定高度和宽度的图像视图 2. 具有固定宽度但动态高度的 Textview 和 3. 具有固定宽度和高度的 Tableview 根据 textview 之后的可用空间进行调整。
我在这里缺少什么限制。为什么我需要给 Textview 或 Tableviews Y pos 或高度约束。这不是让他们的身高固定吗?
解决方案
You have to put a height constant to your textview. Because autolayout can't figure out how many pixels to give to your both view. If you want to adapt your height depending on the text, you can use :
TextViewHeightConstraint.constant = [TextView intrinsicContentSize].height
into your code after your link your constraint via iboutlet.
推荐阅读
- reactjs - ReactJS 错误没有从 Render 类 Render() 中的 Const 返回
- arrays - 不确定如何访问 firebase 数据库中的每个值
- javascript - 为什么看不到宽 50 像素和高 25 像素的图表
- c - Handle logout and sorting in an array of socket threads
- arrays - How can I extract from an array of json object that is saved as text?
- javascript - AWS Amplify Modular Imports with Vue
- docker - Docker - transfer image of database with its content
- javascript - 获取目标元素之后的所有元素id
- ios - .tag 在 Swift 4 中尝试 segue 3 个可能的值时不起作用
- sql - SQLite 慢选查询