简体   繁体   中英

Negative origin of frame of UIView after subsequent layout

I get a frame = (-335 -560; 375 608) on 2nd and subsequent layouts, where the origin becomes negative (-335,-560). This causes the view to be drawn off screen. This view is the root view of a UIViewController. The view is a composition of 10 subviews constrained vertically, like in a vertical-axis stack view. I constrain the top anchor of the highest subview to this view's top anchor.

I don't know how to constrain this view's top anchor to be at (0,0) origin. What am I doing wrong?

正确的方法是将自己的自定义视图作为子视图添加到默认视图控制器视图,并将自定义视图的位置锚点绑定到该视图。

Check the Super view is constraint Whether its frame have negative origins and set zero Spacing to corresponding view to superview . refer the image Attached enter image description here

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