Group Group Group Group Group Group Group Group Group

Scroll View School · Auto Layout |

This is a companion discussion topic for the original entry at

Hi @catie and @jessycatterwaul!

Do you know if zooming can be done when we are using auto-layout to set the scrollView.contentSize?

I tried, without luck.



@catie @jessycatterwaul Can you please help with this when you get a chance? Thank you - much appreciated! :]

1 Like

It can!

Try constraining an image view and scroll view like we do at the start of this video. Then, the only changes you should need to make to the Zooming code are:

  1. Don’t set imageView.frame.size in viewDidLoad.
  2. In setZoomParameters, use the size of the image instead of the image view. Replace imageView.bounds.size with imageView.image!.size (feel free to unwrap that safely, like a responsible person :grimacing:)

If you want to implement centering, I believe you’d need to update the constraints instead of changing the content insets, but I haven’t tried it myself.

1 Like

Hi @catie! Thank you for your answer.

1 Like

Hi Cathy and Jessy,

I was not able to add constraint to scrollview as the video, instead of having the scrollView fullpage I am having this result and error message. " Scrollable Content Size Ambiguity"

also under the scrollview, I am having " Content Layout Guide and Frame Layout Guide" which are not appearing in the tutorial.( probably due to a new version of X code)

I tried several time but still “stuck” at this place.
Could you please let me know what went wrong and how to remediate to it ?

it will be greatly appreciated !!

With thanks and regards

@jessycatterwaul @catie Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi! First, you’ll need to add the Image View to the Scroll View. After that, the difference is you’ll constrain that Image View to the Content Layout Guide, not the Scroll View itself. That should get rid of the errors you’re seeing :]

1 Like

Select the scrollView from the document outline, navigate to the size inspector and untick the box for Content Layout Guides.
That should fix it.

see image ! MUST be constrained to Content Layout Guide. RW should update the tutorial for ios13.

1 Like

Thanks for your comment! This course is on our list to update :]
For now, I’ve added an Author Note to this video.