Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to navigate from one view to other view using UIPageControl?

I have page control but not navigating to other view. so please provide the solution.

    pageControl=[[UIPageControl alloc] initWithFrame:CGRectMake(0,380,320,40)];
    pageControl.backgroundColor=[UIColor clearColor];
    pageControl.userInteractionEnabled =YES;
    [pageControl addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventValueChanged];

    [pageControl setHighlighted:YES];


-(void)pageAction:(UIPageControl*)control
{       
    [self displayNextPage];
    [self displayPreviousPage];
}

Thank You, Madan Mohan.

like image 900
Madan Mohan Avatar asked Mar 04 '10 11:03

Madan Mohan


1 Answers

Hope this helps:

-(void)pageAction:(UIPageControl*)control
{       
int page = pageControl.currentPage;
CGRect frame = pagingScrollView.frame;
frame.origin.x = (myScrollView.frame.size.width * page);
[myScrollView scrollRectToVisible:frame animated:YES];
}
like image 152
Jonah Avatar answered Nov 14 '22 19:11

Jonah