Tag: uigesturerecognizer

UIGestureRecognizer和UITableViewCell问题

我将UISwipeGestureRecognizer附加到cellForRowAtIndexPath:方法中的UITableViewCell ,如下所示: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipe:)]; gesture.direction = UISwipeGestureRecognizerDirectionRight; [cell.contentView addGestureRecognizer:gesture]; [gesture release]; } return cell; } 但是, didSwipe方法总是在成功刷卡时被调用两次。 我最初认为这是因为手势开始和结束,但是如果我注销了gestureRecognizer本身,它们都处于“结束”状态: -(void)didSwipe:(UIGestureRecognizer *)gestureRecognizer { […]

如何将UITapGestureRecognizer实现到我的应用程序中

我对编程和Objective C是相当新的。我想知道如何制作一个应用程序,它有一个空白的屏幕和一分钟的计时器。 你打算尽可能快地挖掘,只要你可以。 我想知道如何在我的代码中实现UITapGestureRecognizer 。

Iphone SDK中的同时手势识别器

我需要使用UISwipeGestureRecognizer (例如, UISwipeGestureRecognizerDirectionRight和UISwipeGestureRecognizerDirectionLeft )来捕捉两个不同的手势。 当我用addGestureRecognizer方法添加两个不同的识别器时,只有最后添加的识别器工作。 我读过,我需要实现的gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: UIGestureRecognizerDelegate协议的方法,但没有任何工作。 任何人都可以帮助捕捉两个或更多相同的手势简单的例子? 谢谢!

UIPageViewController手势识别器

我一直在申请一段时间,但是由于NDA,我不能问这个问题。 我有一个UIPageViewController加载我的Viewcontroller。 视图控制器具有由PageViewControllers手势识别器覆盖的button。 例如,我在viewcontroller的右侧有一个button,当你按下button时,PageViewController接pipe并改变页面。 我如何使button接收触摸并取消PageViewController中的手势识别器? 我认为PageViewController使得我的ViewController成为其视图的子视图。 我知道我可以关掉所有的手势,但这不是我要找的效果。 我不希望子类的PageViewController作为苹果说,这个类不打算分类。

UIGestureRecognizer是否在UIWebView上工作?

我试图得到一个UISestureRecognizer与一个UIScrollView的子视图的UIWebview。 这听起来很奇怪,但是当我将numberOfTouchesRequired设置为2时,select器会触发,但是当numberOfTouchesRequired设置为1时,select器不会触发。 这是我的代码: UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(select1:)]; tap1.numberOfTouchesRequired = 2; tap1.numberOfTapsRequired = 1; tap1.delegate = self; [self.ans1WebView addGestureRecognizer:tap1]; [tap1 release]; – (void) select1:(UILongPressGestureRecognizer *)sender { //Do Stuff } 我已经证实了这一点,使用UIGestureRecognizer的苹果示例,并在他们的笔尖插入一个webview。 他们的抽头代码在任何地方工作,但在webview的区域内。

手势识别器和button操作

我有一个看起来像这样的视图层次结构: UIView (A) UIView > UIImageView UIView > UIView (B) UIView > UIView (B) > Rounded Rect Button UIView > UIView (B) > UIImageView UIView > UIView (B) > UILabel 我已经附加了手势识别器(S)到我的UIView(B)。 我面临的问题是,我没有得到UIView(B)内的Rounded Rect Button的任何操作。 singleTap手势识别器捕获/覆盖button的Touch Up Inside事件。 我怎样才能使它工作? 我认为响应者链接层次结构将确保button触摸事件将被给予优先,并将触发! 我错过了什么? 这里有一些相关的代码: #pragma mark – #pragma mark View lifecycle (Gesture recognizer setup) – (void)viewDidLoad { [super […]

你可以附加一个UIGestureRecognizer到多个视图?

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTapTap:)]; [self.view1 addGestureRecognizer:tapGesture]; [self.view2 addGestureRecognizer:tapGesture]; [tapGesture release]; 在上面的代码中,只有view2上的点击才被识别。 如果我注释掉第三行,那么view1上的轻敲就会被识别出来。 如果我是对的,你只能使用手势识别器一次,我不知道这是一个错误,或者只是需要更多的文档。