Force UIImageView Auto Layout Size

I am working on an application intended only for iOS 6, and I am using nib files for the user interface (and not for storyboards).

I have a view in a view controller that contains a UIImageView as a preview. I need the image size to be 320x320 on Retina 3.5 and Retina 4 screens.

I started designing a view in IB with a Retina 4 Full Screen screen size. I reset the UIImageView in my opinion and set its size to 320x320. Then I linked the height of the image to a limit of 320. At that moment, the time limit changed to a user limit (that is, it is blue instead of purple).

Other limitations affecting image presentation:

  • Trailing space for: Superview 0
  • Leading space: Superview is 0
  • Top space: Superview is 0

So there is no bottom space: Superview restriction limitation.

Now the problem arises if I switch the view size (in Simulated Metrics) to Retina 3.5 full screen.

When I do this, the image height restriction changes to purple and to 232.

I do not know how to solve this problem. I would like the height to remain at 320. I thought that this would affect the lower space by: limitation, but given that there are no definitions, why does the image height change?

Thanks in advance!

+4
source share
1 answer

Just created a test project to recreate your scenario. I had no difficulties. See screenshots below for simulated retina 3.5 "and 4" retinas.

Btw I know this is not an answer, but it allows me to enable screen capture.

As you can see, image size is supported at 320 x 320 in Xcode. It also works well on a simulator. The upper, leading, and final constraints are zero. No lower limit set.

Makes me think you should have something else? Could you post a capture of your Xcode window?

enter image description here

enter image description here

0
source

All Articles