ios - how to show view controller from UIPreviewAction in swift -
i support 3d touch, did when using strong pulled cell appeared controller , user picked up, shown action, there button show want when user clicks on it, controller opens. how can show 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] }
i changed code
@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] }
Comments
Post a Comment