我使用UIPageControl
以及UISwipeGestureRecognizer
在视图控制器之间切换。页面使用刷卡进行更改。UIPageControl - 点击按钮更改页面
我还需要在其中一个视图控制器上按下UIButton
时更改页面。
这里是刷卡是如何用来改变观点:
- (void)swipeRightToLeftGesture:(UIGestureRecognizer *)gestureRecognizer {
if (self.pageControl.currentPage == 0) {
[UIView animateWithDuration:1
animations:^{
for (UIViewController *vc in self.childViewControllers) {
CGRect frame = vc.view.frame;
frame.origin.x -= self.view.frame.size.height;
vc.view.frame = frame;
}
}];
self.pageControl.currentPage = 1;
}
}
我希望这个问题是清楚的。我尽力说清楚。
当你说“导航”,你是指“UINavigationController”或“UIScrollView”或其他?请更具体一点。 – hgwhittle
我对帖子进行了编辑。 – Dinesh
请发布您的代码。 – hgwhittle