I have set up a UIImageView using AutoLayout. I have set constraints for top, bottom, leading, and trailing (I would like the width and height to change based on the size of the phone). In my attributes inspector, it also shows a width and height for the image view. For some reason when the view is first loaded, the Top Space to Top Layout constraint is ignored and the image goes off the screen, and the height in IB is used (332). Once a photo has been added the view resizes as expected. I NSLogged the frame height of the image view, and it is changing. I do not understand, I thought the FRAME of the image view was always the same. I am not getting any Auto Layout errors, everything is blue.
UIImage *imageToView = [existingImage resizedImageWithBounds:self.selectPhoto.frame.size];//Resize the image for better performance
self.selectPhoto.contentMode =UIViewContentModeScaleAspectFit;
NSLog(@"Select Photo Frame Size Height is %f", self.selectPhoto.frame.size.height); //The first time this screen loads, this height is 332. Every other time (after the user enters a new photo, the height is 310 which is what I want.
self.selectPhoto.image = imageToView;
Recap : Why is my self.selectPhoto (which is the large image view shown in screenshot).frame changing? I double checked the Apple Docs, and it doesn't say anything about frame changing based on image size. It matters because I'm resizing my image based on the frame size.