IOS 8 imageView inside scrollView with auto shutdown

It's very simple ViewController

. I have imageView

inside a scrollView

. Using autolayout, I set constraints scrollView

to its edges view

. Also, the mode imageView

AspectFit

.

enter image description here

The image is provided at run time and can be a landscape or a portrait. When I launch the application, the image does not fit the current screen size. It seems that the boundaries are scrollView

not being met, so only part of the image is displayed. It used to work with ios7 and xcode5, but it got corrupted for ios8 xcode6.

enter image description here

Any ideas? I need to use autorun all the time.

+3


source to share


3 answers


You are going to set the horizontal constraints of the image and bind them to self.view (the parent view of the scrollviews) instead of the scrollview.



Here's a good example of this: Using UIScrollView with auto layout in iOS

+1


source


Try to zoom out completely



[self.scrollView zoomToRect:self.imageView.frame animated:YES];

      

+1


source


Have you tried calling imageView.sizeToFit () on viewDidLoad? My impression is that the size of the imageView is fluid until the sockets are set. The call to the sizeToFit method is causing the problem.

+1


source







All Articles