This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9223-scroll-view-school/lessons/9
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/9223-scroll-view-school/lessons/9
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.
Thanks,
Andrés.
@catie @jessycatterwaul Can you please help with this when you get a chance? Thank you - much appreciated! :]
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:
- Don’t set
imageView.frame.size
inviewDidLoad
. - In
setZoomParameters
, use the size of the image instead of the image view. ReplaceimageView.bounds.size
withimageView.image!.size
(feel free to unwrap that safely, like a responsible person)
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.
Hi @catie! Thank you for your answer.
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
Samson
@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 :]
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.
Thanks for your comment! This course is on our list to update :]
For now, I’ve added an Author Note to this video.
hey @jessycatterwaul @jcatterwaul @catie thanks for making such a good tutorials , guys currently I’m using Xcode 11.4.1 and its not working even please help me.
Hi! Take a look at the other questions people have asked on this episode. It may help you out!
I also added an author’s note to the episode:
For Xcode 11 & iOS 13:
Constrain views within a Scroll View to the Content Layout Guide instead of the Scroll View itself.
Let me know if that helps you! :]