我有一些麻烦来处理iPhone上的滑动,我在我的界面中创建了一个UISwipeGestureRecognizervar:
UISwipeGestureRecognizer *swipeRecognizer;
并在我的控制器中:viewDidLoad方法
- (void)viewDidLoad { [super viewDidLoad]; // Horizontal swipe swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeMethod:)]; swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft; [self addGestureRecognizer:swipeRecognizer]; }
我的方法来处理刷卡是:
-(void)swipeMethod: (UISwipeGestureRecognizer *) sender { NSLog(@"Swipe!"); }
当我运行代码并进行滑动时,我什么都没有?我应该得到:滑动!
谢谢.