我使用了下面的代码
[self.navigationController.interactivePopGestureRecognizer addTarget:self action:@selector(handlePopGesture:)];
- (void)handlePopGesture:(UIGestureRecognizer *)gesture {
if (gesture.state == UIGestureRecognizerStateBegan)
{
} else if (gesture.state == UIGestureRecognizerStateEnded) {
NSArray *views = [self.navigationController viewControllers];
[self.navigationController popToViewController:[views objectAtIndex:1] animated:YES];
}但是它不工作任何想法如何使用interactivePopGestureRecognizer弹出视图控制器?
发布于 2014-06-15 23:50:40
确保您的.h文件是委派。
@interface YOURVIEWCONTROLLER : UIViewController <UIGestureRecognizerDelegate> 在您的.m中包含
self.navigationController.interactivePopGestureRecognizer.delegate = self;那么你的委托方法应该能识别你的手势。
https://stackoverflow.com/questions/24107037
复制相似问题