我想通过像我一样滑动控制器来更改视图控制器,当我滑动消息框应该从 ViewController1->ViewController2 和从 viewController1<-viewController2 滑动时,我知道我必须使用或者UISwipeGestureRecognizer
可能使用ViewControllers 的内容而不是 Views。像默认 messageViewController 滑动到 EmailViewController 或 EmailViewController 到 MessageViewController。有什么想法怎么做吗?UIScrollView
UIPageController
问问题
958 次
1 回答
1
- (void)goToNext{
//your code to load youn next view controller
}
- (void)goToBack{
//your code to load your previous view controller
}
- (void)viewDidLoad{
[super viewDidLoad];
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToNext)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToBack)];
[recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)];
[[self view] addGestureRecognizer:recognizer];
[recognizer release];
}
于 2012-07-16T10:56:02.563 回答