3D触摸响应

时间:2016-05-25 18:52:23

标签: ios objective-c iphone swift 3dtouch

我想在我的混合应用程序上实现3D Touch。我可以使用self.webView.allowsLinkPreview = true;

来解决问题

但现在问题是,当我点击帮助链接时,它需要当前会​​话才能打开帮助内容。是否可以将任何参数传递给webview for 3D Touch以打开网页?

1 个答案:

答案 0 :(得分:0)

我的建议是你可以在3D Touch中使用 peek and pop 功能。有关查看和弹出功能的完整指南,请参阅以下链接。

  1. https://the-nerd.be/2015/10/06/3d-touch-peek-and-pop-tutorial/
  2. http://krakendev.io/peek-pop/
  3. 只需在目标View Controller中保留一个webView,并保留一个名为" link"的属性。在该视图控制器类中。使用3D Touch时,请更新

    中的链接属性值
    func previewingContext(previewingContext: UIViewControllerPreviewing,viewControllerForLocation location: CGPoint) -> UIViewController? {
    
    //create the instance of the target view controller and assign the link you want to open to "link" property
    
    }
    

    然后使用

    打开该链接
    myWebView.loadRequest(NSURLRequest(URL: link!))