scrollView を使用する必要があります。
-(void)viewDidLoad{
scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
scrollView.delegate = self;
scrollView.pagingEnabled = YES;
[scrollView setScrollEnabled:NO];
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
[scrollView setContentSize:CGSizeMake(320*pageCount, 480)];
for(int i = 0; i < pageCount; i++){
//Create your labels and segmented control here
}
}
-(void)nextButtonPressed{
int currentPage = (scrollView.contentOffset.x/320);
int nextPage = currentPage + 1;
[scrollView scrollRectToVisible:CGRectMake(320*nextPage, scrollView.frame.origin.y, scrollView.frame.size.width, scrollView.frame.size.height) animated:NO];
}
コンセプトは、すべてのページを含む scrollView を作成することです。私が pageCount と呼んだ int があります。したがって、次のボタンを有効にしてユーザーが押すたびに、scrollView は次のページにスクロールします。