I have a UIPageControl. When I click on a dot to change the page, nothing happens. Second dot does not get highlighted.
It works fine, however, when I scroll my UIScrollView. In that case the second dot is highlighted.
pageControl = [[UIPageControl alloc] init] ;
pageControl.center = CGPointMake(160.0f, 430.0f);
pageControl.numberOfPages=nPages;
pageControl.currentPage=0;
pageControl.hidesForSinglePage = YES;
pageControl.userInteractionEnabled =YES;
[pageControl addTarget:self action:@selector(pageTurn:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:pageControl];
This should be called when I change pageControl Value but it does not get called since it does not respond to touch.
- (void) pageTurn: (UIPageControl *) aPageControl
{
int whichPage = aPageControl.currentPage;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
sv.contentOffset = CGPointMake(320.0f * whichPage, 0.0f);
[UIView commitAnimations];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With