简体   繁体   中英

How to Configure AutoLayout for UIView

I have a UIView in my iOS app that holds a graph. I have fully constrained the UIView in Interface Builder but yet when I view the page on my iPhone 6 the graph is a nice large size but yet when viewed on an iPhone 4s, the view appears much shorter to the point where it's uncomfortable to look at.

The constraints are as follows: 在此处输入图片说明

As viewed on an iPhone 4s: 在此处输入图片说明

As viewed on an iPhone 6: 在此处输入图片说明

How can I adjust the constraints so that the iPhone 4s UIView has similar proportions to that of the iPhone 6?

There might be some conflict in the constraints in 4S. For this UIView, if the superview is fixed in terms of size, then only 2 of the following constraints need to be set.

  • align top to superview
  • align bottom to superview
  • height equals 150

Or if the superview is not fixed in size, then the superview constraints might have conflict with the tableview down below. try to set the tableview height using percentage, not the fix number?

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