gpt4 book ai didi

ios - 如何快速显示来自 UIPreviewAction 的 View Controller

转载 作者:搜寻专家 更新时间:2023-11-01 07:27:28 24 4
gpt4 key购买 nike

我确实支持 3D Touch,我这样做是为了当使用强力拉动 cell 时出现 Controller ,然后用户拿起它,向他展示 Action ,当用户点击它时会有一个按钮显示我想要的, Controller 完全打开。如何显示此 Controller ?

 @available(iOS 9.0, *)
override func previewActionItems() -> [UIPreviewActionItem] {
let showAction = UIPreviewAction(title: "Show", style: .Default) { [weak self] (action: UIPreviewAction, vc: UIViewController) -> Void in
guard let weakSelf = self else {
return;
}

if let _popAction = weakSelf.popAction {
_popAction()
}
self?.showViewController(vc, sender: nil)
print("show city controller")
}

return [showAction]
}

最佳答案

我修改了代码

 @available(iOS 9.0, *)
override func previewActionItems() -> [UIPreviewActionItem] {
let showAction = UIPreviewAction(title: "Show", style: .Default) { [weak self] (action: UIPreviewAction, vc: UIViewController) -> Void in
guard let weakSelf = self else {
return;
}

if let _popAction = weakSelf.popAction {
_popAction()
}
self?.showViewController(vc, sender: nil)
print("show city controller")
}
let cityController = CityController()
cityController.showPreviewController()
return [showAction]
}

关于ios - 如何快速显示来自 UIPreviewAction 的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35032999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com