0
votes

I've created a custom UIView which contains a UIScrollView. I then fill it with a UIView which is 3 times as wide.

Inside my UIViewController, I instantiate my custom UIView and add it to the view.

However, when I attempt to scroll the scrollview horizontally, it doesn't move.

I'm setting the contentView and the contentSize. User interaction is enabled. When I touch the buttons, they respond. But the view doesn't scroll.

Is there something special you need to do when adding a custom UIView with a scrollview onto a UIViewController (like passing down the touches, or something like that?).

1
Did you set the contentSize property of UIScrollView?KudoCC
@KudoCC - yes, contentSize property is being set. In fact no matter what I set it to, the scrollview does not scroll.theDuncs
Can you post some code on how you add subView of UIScrollView and how to config the UIScrollView. Upload your demo is even better.KudoCC
Guys. I solved the problem. When I added a UIPageControl to my view, it added it INSIDE the scrollview control in the IB. That blocked it from scrolling. By moving the PageControl out of the scrollview in the IB (i.e no longer as a subview) it works fine. Thanks for all your help! @KudoCCtheDuncs

1 Answers

0
votes

It turns out that when I added a UIPageControl to my UIView in the IB, it inserted the UIPageControl as a subview of the UIScrollView. It was thing which stopped my scrollview from scrolling.

By removing the UIPageControl from the scrollview, it all worked fine.

BAD! Bad

GOOD! Good