如何使用自动布局将 UIView 置于顶部
How to place UIView at top using Autolayout
我想使用自动布局将 UIView 放置在视图控制器的顶部,我已经尝试了很多,UIView 高度在 iPhone 4 中变小,在 iphone 6 及更高版本中变大,我该如何解决? Attached image for reference
我认为如果您向该视图添加 height constraint
,它会解决您的问题。要设置 height constraint
,请检查此 link
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraintsinInterfaceBuidler.html
正如我从你的问题中了解到的,如果你需要在顶部固定子视图的大小,那么不要给出底部间距约束。
请如下图所示设置约束。
我想使用自动布局将 UIView 放置在视图控制器的顶部,我已经尝试了很多,UIView 高度在 iPhone 4 中变小,在 iphone 6 及更高版本中变大,我该如何解决? Attached image for reference
我认为如果您向该视图添加 height constraint
,它会解决您的问题。要设置 height constraint
,请检查此 link
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraintsinInterfaceBuidler.html
正如我从你的问题中了解到的,如果你需要在顶部固定子视图的大小,那么不要给出底部间距约束。
请如下图所示设置约束。