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:

enter image description here

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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -