Tag: uilongpressgesturerecogni

需要应用UIRotationGestureRecognnizer,然后是UILongPressGestureRecongnizer

在一个视图上应用UILongPressGestureRecongnizer ,请查看以下代码以供参考。 @interface ViewController () { UIRotationGestureRecognizer *rotationGestureRecognizer6; } – (void)viewDidLoad { //——–Added LongPress Gesture———-// UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; longPress.minimumPressDuration = 2.0; [view6 addGestureRecognizer:longPress]; rotationGestureRecognizer6 = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotationWithGestureRecognizer:)]; } #pragma mark – UILongPressGesture Handler Method -(void)handleLongPress:(UILongPressGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateEnded) { NSLog(@"UIGestureRecognizerStateEnded"); } else if (sender.state == UIGestureRecognizerStateBegan){ […]

在长按识别器结束之后,wkwebview在调用正在导航行为

我试图覆盖原来的wkwebview操作… 首先,我通过webView.evaluateJavaScript webView.evaluateJavaScript("document.body.style.webkitTouchCallout='none';", completionHandler: nil)禁用了原始的wkactionsheet 然后我初始化一个长按手势识别器(它完美的工作),我创build了我自己的操作表。 我用decidePolicyForNavigationAction来获取点击链接的url: func onLongPress(gestureRecognizer:UIGestureRecognizer){ if gestureRecognizer.state == UIGestureRecognizerState.Began { longPressSwitch = true } } func webView(webView: WKWebView, decidePolicyForNavigationAction navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) { if(navigationAction.navigationType == .LinkActivated) { longPressAcUrl = navigationAction.request.URL!.absoluteString if(longPressSwitch == true) { let ac = actionMenu(self) self.presentViewController(ac, animated: true) { } decisionHandler(.Cancel) longPressSwitch = false } […]