How to use a "Page Control" using Xcode 4.2 and storyboard?
Ok here is a workflow for a typical case:
1.Create an IBOutlet for your pageControl object
Example:
@property (unsafe_unretained, nonatomic) IBOutlet UIPageControl *pageControl;
2.Create an IBAction as well for the "Value Changed" event of the same pageControl
Example:
-(IBAction)pageDidChange:(id)sender;
Every time the user changes the page now, your pageDidChange: method will be fired.
Now, here are some common methods:
Setup the number of pages
[self.pageControl setNumberOfPages:6];
Set the current page
[self.pageControl setCurrentPage:1];
I hope that this will get you started...
Related videos on Youtube
Shredder2794
Updated on June 04, 2022Comments
-
Shredder2794 almost 2 years
I'm trying to learn the basics of iOS programming and I was wondering how you would use a page control using Xcode 4.2 and storyboard? I'm subscribed to MyCodeTeacher.com and the lesson on Page Controllers is outdated and doesn't work with the new Xcode. I cant find a tutorial via Google and the Apple Documentation isn't helping either. Can someone point me to a good tutorial or give me a basic example?
Thank you SO much!
-
Shredder2794 about 12 yearsThanks! How would I go about adding a view to each page?
-
Alladinian about 12 yearsThe pageControl does not "hold" any views. A typical scenario would be a scrollView containing several views inside it and a pageControl to help with the paging (google "uiscrollview paging" and you should find enough material.