I am using UIPageControl
and UISwipeGestureRecognizer
to switch between 2 view controllers of my application. I have modified this tutorial without using scroll view.
I have 2 issues:
1) Using the swipe gesture is changing the view controllers/pages but not the dots indicating the current page. I have tried
if (self.pageControl.currentPage == 0) {
self.pageControl.currentPage = 1
}
but I am not sure why it does not work. I have the outlet available
@property (strong, nonatomic) IBOutlet UIPageControl *pageControl;
2) I am using - (IBAction)changePage:(id)sender
for changing the page. I would like to know how to change to a page on clicking on a certain dot. I mean to say that on clicking on dot 1, I should go to the first view controller and on clicking on dot 2, I should navigate to the second view controller.
pageControl
outletnil
? Tapping on dots will be hard (they are too small, and not an easy to calculate position). – SubmultiplepageControl = [[UIPageControl alloc] init];
When I doNSLog(@"pageControl = %@",pageControl);
, I getpageControl = <UIPageControl: 0x8d766d0; frame = (0 0; 0 0); autoresize = W; layer = <CALayer: 0x8d75500>>
– VentopageControl = [[UIPageControl alloc] init];
That was why current page was not working. Now it works. But could you guide me as to how to change the page on clicking a particular dot - it might not be so easy but I would like to try it. – Vento