为手动 Segue 实施 3D Touch "Peek and Pop"
Implement 3D Touch "Peek and Pop" for Manual Segue
我正在尝试弄清楚如何为我正在处理的应用程序实现 "Peek and Pop" 3D 触摸功能,但我不确定如何为手动转场实现该功能,所以任何帮助或文件将不胜感激。
为了向您提供更多信息,我有一个 UITableView
谁的控制器有 2 个手动 segue,我的代码根据用户点击的 table 元素在它们之间进行选择。如果它是我从原型 table 单元格拖到目标视图控制器的一个 segue,我可以选中一个框,但是手动 segues 不存在该框。
我用谷歌搜索了一下是否有这方面的文档,但我找不到任何东西。
根据 UIViewControllerPreviewingDelegate Reference,实施
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController)
Implement this method to configure and present the commit (pop) view
controller, in a way that is appropriate for your app.
For example, to present the commit view controller’s view in a
navigation controller, call the navigation controller’s
showViewController:sender: method; to present the view modally, you
could call the presentViewController:animated:completion: method.
所以在你的实现中你可以说:
func previewingContext(previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController){
self.navigationController.showViewController(viewControllerToCommit,sender:self)
}
或
func previewingContext(previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController){
self.navigationController.pushViewController(viewControllerToCommit,animated:true)
}
如果您对此更满意。
我正在尝试弄清楚如何为我正在处理的应用程序实现 "Peek and Pop" 3D 触摸功能,但我不确定如何为手动转场实现该功能,所以任何帮助或文件将不胜感激。
为了向您提供更多信息,我有一个 UITableView
谁的控制器有 2 个手动 segue,我的代码根据用户点击的 table 元素在它们之间进行选择。如果它是我从原型 table 单元格拖到目标视图控制器的一个 segue,我可以选中一个框,但是手动 segues 不存在该框。
我用谷歌搜索了一下是否有这方面的文档,但我找不到任何东西。
根据 UIViewControllerPreviewingDelegate Reference,实施
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController)
Implement this method to configure and present the commit (pop) view controller, in a way that is appropriate for your app.
For example, to present the commit view controller’s view in a navigation controller, call the navigation controller’s showViewController:sender: method; to present the view modally, you could call the presentViewController:animated:completion: method.
所以在你的实现中你可以说:
func previewingContext(previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController){
self.navigationController.showViewController(viewControllerToCommit,sender:self)
}
或
func previewingContext(previewingContext: UIViewControllerPreviewing,
commitViewController viewControllerToCommit: UIViewController){
self.navigationController.pushViewController(viewControllerToCommit,animated:true)
}
如果您对此更满意。