ios - How to resize a UIImageView (for 3.5" and 4") in interfaceBuilder with constrain -


I am trying to keep UIImageView in the UIView of my ViewController, change UIViewView to a size when UIView 480px or 568px height . But in IB it is incredibly complex!

If I put a normal view inside my View Controller, it will naturally change shape but it does not do with my UIImageView. Even if I choose scale tofill mode, nothing will happen.

It seems that I need to use constraints but the problem is that when I add a simple obstacle, just tell UIImageView as X height size. The IB tells me that there are errors, and ask me to add many obstacles to other components of the view. It's promoting and I'm ending up with thousands of shortages. This is misleading, because I just want to resize my UIView in my container and in order to tell it to IB, I need to add an obstacle to other components that never ask anything.

Only two lines in the code! I do not understand why this is so complicated in IB so can anyone tell me how to change my UIImageView shape according to my parents?

I did a lot of research on Google, it seems like no one can not use full image view mode.

Note that I am already successful in another view controller for a full view UIImageView, but it is a kind of obscure but now I do not know when I do the same thing, Wants to add a lot of obstacles.

I think it would be better if you supervised rather than a height / width reduction (i.e. view controller ) Will use the odds with the distance select your image view and add obstacles like this:

Image details here

Image view will automatically fill the screen on both 3,5 "and 4" on both iPhones. Then, to get the desired effect, just select the contentMode Area to play with.


Comments