简体   繁体   中英

How to center vertically 2 labels with IB constraint and auto layout iOS

Im am building a user interface using storyboard and autolayout and i'm struggling with layout and constraints, I have a UIView (container) that contains 1 UIView and 2 labels, the UIView has an 16:9 aspect ratio and the two labels are in a UIView with a center vertically constraint witch gives me this in IB : storyboard layout

for some reasons, probably wrong constraints or missing constraints, layout is different at runtime, (I don't have any auto-layout issues in IB)

view at runtime not center

So how can I center vertically these 2 labels in my container

I need your help, thank you!

这2个标签应使用另一个视图包含。并从绿色视图中引用约束。最后,您需要对刚创建的视图创建约束2个标签。垂直居中约束需要引用包含2个标签的视图

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