使用 AutoLayout 缩小 UIImageView 高度
Use AutoLayout to scale down UIImageView height
所以,在我的应用程序中,我有一个 UIView(它会调整大小以保持相同的纵横比,以便它始终接触屏幕的两侧)并且在该视图中,我在其顶部有一个 UIImageView 和一个 UITextView。
视觉上(粉色矩形是文本视图):
我想要实现的是,如果 UITextView 变高(向其添加更多文本),它会降低 UIImageView 的高度。 视觉上:
我应该使用什么约束或如何使用自动布局来实现?
提前致谢!
UITextField constraints:
Leading space, Trailing space, Top space to UIView margins constraints + Height constraints文本框。
UIImageView 约束:
Leading space,Trailing space,Bottom space to UIView margins constraints + Top space constraints到 UITextField。
然后,当您更改 UITextField 的高度约束时,您的 UIImageView 将向下移动。
所以,在我的应用程序中,我有一个 UIView(它会调整大小以保持相同的纵横比,以便它始终接触屏幕的两侧)并且在该视图中,我在其顶部有一个 UIImageView 和一个 UITextView。
视觉上(粉色矩形是文本视图):
我想要实现的是,如果 UITextView 变高(向其添加更多文本),它会降低 UIImageView 的高度。 视觉上:
我应该使用什么约束或如何使用自动布局来实现?
提前致谢!
UITextField constraints:
Leading space, Trailing space, Top space to UIView margins constraints + Height constraints文本框。
UIImageView 约束:
Leading space,Trailing space,Bottom space to UIView margins constraints + Top space constraints到 UITextField。
然后,当您更改 UITextField 的高度约束时,您的 UIImageView 将向下移动。