增加手势
- (void)viewDidLoad {
[super viewDidLoad];
UIScreenEdgePanGestureRecognizer* screenEdgePan =[[UIScreenEdgePanGestureRecognizer alloc]initWithTarget:selfaction:@selector(action:)];
screenEdgePan.edges = UIRectEdgeLeft;
[self.view addGestureRecognizer:screenEdgePan];
}
-(void)action:(UIScreenEdgePanGestureRecognizer*)sender{
if (sender.edges == UIRectEdgeLeft) {
NSLog(@"正在从左边滑动");
switch (sender.state) {
case UIGestureRecognizerStateBegan:
NSLog(@"手势开始");
break;
case UIGestureRecognizerStateChanged:
NSLog(@"手势进行中");
break;
case UIGestureRecognizerStateEnded:
NSLog(@"手势结束");
break;
default:
break;
}
}
}