简体   繁体   中英

programmatically changing height of view ignores constraints

I have a problem on constraints on view when programmatically changing its frame.

So I have the following layout. What I intended to do is when the yellow view is clicked, the date picker view(Open Hour Picker) expands in between the yellow bar(first bar) and the bars below. As the Open Hour Picker expands, the bars below move down. The way I expands the Open Hour Picker is that Open Hour Picker starts with height 0, and when yellow bar clicked, the Open Hour Picker expands its height using UIView.animate().

The second image shows the constraints on the second darkgray bar.

在此处输入图片说明

在此处输入图片说明

通常,当约束被忽略时,您要做的第一件事是确保进行设置:

view.translatesAutoresizingMaskIntoConstraints = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM