I am investigating this problem for three days without much result.
According to what I found on Stackoverflow, I should set the content size bigger than my actual content, which I have done:
self.scrollView.contentSize =CGSizeMake(320, 700);
I also have added Autolayout constraints
for each item in the scrollview container, to stick to the superview (scrollview) and to each other.
However there is no joy. I have uploaded this example on Github.
What am I missing please? Thanks
You have a constraint wrong.
That bottom constraint should be set to 0 (it's -138). Then all should work. I just tried it.
If you are using Autolayouts, the contentSize
property of UIScrollView
doesn't work anymore. You will have to establish scrollview intrinsic size using Autolayout constraints.
You could check this tutorial about ScrollViews and Autolayouts for more info:
http://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.