How can i change the page on clicking the dots of UIPageControl

前端 未结 4 1506
太阳男子
太阳男子 2020-12-29 18:29

Here I have a pagecontrol which works good but on clicking on dot it doesn\'t change the page so please help in the function of changepage:

- (void)viewDidLo         


        
4条回答
  •  情书的邮戳
    2020-12-29 18:51

    You can create one event change page:

    - (IBAction)changePage:(id)sender {
        UIPageControl *pager=sender;
        int page = pager.currentPage;
        CGRect frame = imageGrid_scrollView.frame;
        frame.origin.x = frame.size.width * page;
        frame.origin.y = 0;
        [imageGrid_scrollView scrollRectToVisible:frame animated:YES];
    }
    

    Bind it to Pagecontrol's value changed event.

提交回复
热议问题