ios - How to implement UIViewControllerTransitioningDelegate in UIStoryboardSegue? -
this now:
func presentoverlaycontroller(controller: uiviewcontroller) { controller.modalpresentationstyle = .custom controller.transitioningdelegate = self presentviewcontroller(controller, animated: true, completion: nil) } //mark: - uiviewcontrollertransitioningdelegate public func presentationcontrollerforpresentedviewcontroller(presented: uiviewcontroller, presentingviewcontroller presenting: uiviewcontroller, sourceviewcontroller source: uiviewcontroller) -> uipresentationcontroller? { return overlaypresentationcontroller(presentedviewcontroller: presented, presentingviewcontroller: presenting) }
it works pretty awesome. first controller storyboard using .instantiateviewcontrollerwithidentifier:
. controller presented right way:
but same result need achieve custom segue:
class overlaysegue: uistoryboardsegue, uiviewcontrollertransitioningdelegate { override func perform() { destinationviewcontroller.modalpresentationstyle = .custom destinationviewcontroller.transitioningdelegate = self } //mark: - uiviewcontrollertransitioningdelegate func presentationcontrollerforpresentedviewcontroller(presented: uiviewcontroller, presentingviewcontroller presenting: uiviewcontroller, sourceviewcontroller source: uiviewcontroller) -> uipresentationcontroller? { return overlaypresentationcontroller(presentedviewcontroller: presented, presentingviewcontroller: presenting) } }
but doesnt work. why?
at end of perform
need call presentviewcontroller(destinationviewcontroller, animated: true, completion: nil)
.
Comments
Post a Comment