IOS在Table View添加3D Touch功能

2020-01-21 02:54:33王旭

添加代理方法打开预览视图: previewingContext(_:commit:):


// Pop 操作
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
              commit viewControllerToCommit: UIViewController)
{
  // 这里使用的条件判断,让你在某些情况下不触发 Pop 操作。
  if xxx {
    show(viewControllerToCommit, sender: self)
    // 根据打开视图的方式选择 show 或 present
    // present(viewControllerToCommit, animated: true)
  }
}

 

 
注:相关教程知识阅读请移步到IOS开发频道。