滑动手势到特定限制

时间:2014-09-04 07:33:37

标签: ios iphone uiview uiswipegesturerecognizer

我需要将滑动手势实现到特定限制。 我尝试使用以下代码

UIView *viewLeftSwipe = [[UIView alloc] initWithFrame:CGRectMake(30, 200, 100, 50)];
viewLeftSwipe.backgroundColor = [UIColor whiteColor];
viewLeftSwipe.userInteractionEnabled = YES;
[self.view addSubview:viewLeftSwipe];

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
[swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
[viewLeftSwipe  addGestureRecognizer:swipeLeft];

但它没有调用以下方法

- (void)handleSwipe:(UISwipeGestureRecognizer *)swipe
{
 NSLog(@"Swipe");
}

0 个答案:

没有答案