iOS /Obj-C UIScrollView and PageControl not working

I am attempting to implement a UIScrollView with a UIPageControl following the guide on this website: http://www.iosdevnotes.com/2011/03/uiscrollview-paging/ In opposite to the guide, I am implementing this in a storyboard project, and using XCode4.5.2. In addition to the code in the guide, I have added at the beginning of the @interface, and inside the viewDidLoad method in the implementation, I have added scrollView.delegate = self.

With only the code and IB-objects described in the guide added to my app, it doesn't allow me to scroll at all when I test it on my iPhone. The only scrolling i can do is by swiping my finger over the UIPageControl, which makes the "white dot" in the PageControl move one spot towards the direction I was swiping, and with no visible changes in the ScrollView. In the guide we add different colours to the backgrounds of the views in the scrollView -- none of these colours show up at all.

I have tried debugging by putting NSLogs in my code to see what methods are reached by the app. Adding an NSLog (@"View did load"); right after [super viewDidLoad]; in the viewDidLoad method atop the main view controller doesn't output anything to the terminal. Does this mean my app doesn't load up properly?

Thanks in advance!

Upvotes: 3

Views: 1125

Answers (2)

Andrea Mario Lufino
Andrea Mario Lufino

Reputation: 7921

If you are interested I created this class for paging with the scrollview

https://github.com/andrealufino/ALScrollViewPaging

Upvotes: 0

Tommy Devoy
Tommy Devoy

Reputation: 13549

Do you have multiple pages added to the scrollView? Scrolling is default off if you only have one page worth of content. Ensure that the loadScrollView method is called and also add this:

scrollView.pagingEnabled=YES;

Upvotes: 3

Related Questions