Tag: uigesturerecognizer

如何一次处理多个触摸手势?

我必须一次在我的imageview上执行所有的手势,意味着用户可以在一次点击的同时移动imageview ,也可以缩放和旋转。现在我发现这种方法执行多个手势,但无法执行缩放轮替]。 – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; – (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; – (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 在应用UIPinchGestureRecognizer , UIRotationGestureRecognizer和UIPanGestureRecognizer之前,它只能处理一个手势。请帮助我解决这个问题,或者给我任何其他更好的select,如果可能的话。

Xamarin UIScrollView GestureRecognizerShouldBegin在滚动视图移动时报告速度为0

我使用Xamarin来开发一个iOS应用程序,我想子类UIScrollView为了处理在滚动视图基于其速度的平移手势。 所以,我重写了GestureRecognizerShouldBegin并检查了平移手势的VelocityInView 。 这适用于第一个手势,但在滚动视图运动(减速)时触发的后续平移手势总是报告(0,0)的速度: public class MyScroll : UIScrollView { public override bool GestureRecognizerShouldBegin(UIGestureRecognizer gestureRecognizer) { UIPanGestureRecognizer panGesture = gestureRecognizer as UIPanGestureRecognizer; if (panGesture != null) { CGPoint velocity = panGesture.VelocityInView(this); Console.WriteLine("Pan gesture velocity: " + velocity); } return true; } } 在滚动处于运动状态的同时平移一次,然后再一次输出: Pan gesture velocity: {X=37.92359, Y=-872.2426} Pan gesture velocity: {X=0, Y=0} 这是一个错误还是这是预期的行为? 编辑:跨Xamarin的论坛上发布: […]

当使用UIScreenEdgePanGestureRecognizer进行快速平移时,translationInView等于0

我创build了一个显示问题的testing项目 。 当我从左边或右边进行快速平移时,在状态UIGestureRecognizerState.Began , translationInView等于(0.0,0.0)。 这种情况发生在当你在landscape ,并在设备的下半部分(在我的情况下是iPhone 6),或者当你在portrait ,并在屏幕的前三分之一(底部)做手势。 这是正常吗? 我想这可能是知道,但找不到任何东西。

UIPinchGestureRecognizer仅用于捏出

我试图创build一个UIPinchGestureRecognizer失败,如果用户捏(移动手指分开)。 我知道有一个非常简单的方法来做到这一点,只是采取行动方法的识别器的规模,如果它大于1,设置一个标志,并忽略所有未来的呼叫。 然而,这不适用于我,我有其他的手势识别器,需要这个捏认识失败,所以我需要它正确地失败时,用户捏在错误的方向。 我试图inheritanceUIPinchGestureRecognizer: @implementation BHDetailPinchGestureRecogniser { CGFloat initialDistance; } #pragma mark – Object Lifecycle Methods – (id)initWithTarget:(id)target action:(SEL)action { self = [super initWithTarget:target action:action]; if (self) { initialDistance = NSNotFound; } return self; } #pragma mark – UIGestureRecogniser Methods – (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)recogniser { if ([recogniser isKindOfClass:[UIPinchGestureRecognizer class]]) { return [self.delegate gestureRecognizerShouldBegin:self]; } else return […]

细胞轻扫事件和button触摸内部事件

我有一个表格单元格视图与4个UIButtons: button有Touch Up Inside事件 @IBAction func increasDealRatingAction(sender:UIButton) { let buttonPosition = sender.convertPoint(CGPointZero, toView: self.tableView) if let indexPath = self.tableView.indexPathForRowAtPoint(buttonPosition) { … } } 我有编辑每个单元格的操作: func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? { … return [addToWishListAction, addToPurchasesAction, deleteAction] } 问题是,当您向左滑动以显示“添加到希望列表”,从“星形button”的位置“删除”动作时,单击也处理了事件,或者在button区域上滑动时滑动动作不会检测到。

ios在对象处理的同时识别手势

与UIKit对象进行交互时是否可以同时识别手势和触摸? 例如,当用户滚动滑块或选取器视图时,我是否也可以处理滑动手势?

使用平移识别器来控制ScrollView

我有一个scrollView与分页启用。 我有一个UIView作为scrollview的子视图。 当scrollView到达其内容的button时,我正在滚动: scrollView.scrollEnabled = false 因为我正在做其他事情,需要拖动scrollView(黄色部分)的一部分。 所以scrollViews偏移locking在页面的button。 我想能够拖动UIView(红色),以启用滚动的scrollView,从而改变scrollviews内容偏移量。 所以我已经添加了一个UIPanGestureRecognizer的UIView,该行动使scrollView的滚动。 问题是,当我开始在UIView上平移时,我不得不提起手指并放下来,然后才能拖动scrollView。 这是一些代码: var scrollView: UIScrollView! var someView: UIView! var panAGes: UIGestureRecognizer! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. scrollView = UIScrollView(frame: CGRectMake(0, 0, view.frame.width, view.frame.height)) scrollView.contentSize = CGSizeMake(view.frame.width, view.frame.height * 2) scrollView.pagingEnabled = true […]

识别屏幕locking的滑动模式n解锁ios

我想创build一个用于locking的滑动模式并解锁屏幕(不用摘下手指即可滑动)。 我如何使用UISwipeGestureRecognizer来做到这一点。 当我再次尝试login时,我想保存并匹配它。 我该如何保存? 作为一个形象或别的东西? 请帮助我这个。 谢谢。

UILongPressGestureRecognizer不在UITextField上工作

我有一个LongPress手势识别器在我的viewcontroller的viewDidLoad方法中初始化如下: longPressGesture_= [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(displayTimeFlagCallout)]; 我在我的视图控制器中有一个tableview。 tableview有自定义单元格。 每个单元格有2个文本框。 当用户长按文本字段(startTime和endTime)时,我想调出一个自定义的popup窗口。 我不希望放大镜和复制/粘贴popup窗口作为标准行为显示在长按文本字段,因此在添加我的手势识别器之前,我正在禁用文本字段的内置长按手势识别器。 我已经将下面的代码添加到我的cellforRowAtIndexPath方法中: MyCustomCell_iPhone *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (cell == nil) { cell = [[MyCustomCell_iPhone alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; for (UIGestureRecognizer *recognizer in cell.startTime.gestureRecognizers) { if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){ recognizer.enabled = NO; } } for (UIGestureRecognizer *recognizer in cell.endTime.gestureRecognizers) { if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){ recognizer.enabled = […]

UIScreenEdgePanGestureRecognizer:顶部和底部边缘

这是否有可能使UIScreenEdgePanGestureRecognizer处理来自顶部 (或底部 )边缘的事件? UIScreenEdgePanGestureRecognizer *gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(userDidPan:)]; gestureRecognizer.edges = UIRectEdgeTop; // UIRectEdgeBottom [self.view addGestureRecognizer:gestureRecognizer]; 问候。