seedante / iOS-Note

个人笔记,包括一些在公众号发表的文章的加长版
907 stars 145 forks source link

How to use custom UIPresentationController in custom ContainerViewController? #3

Closed mortyccp closed 3 years ago

mortyccp commented 8 years ago

How can we use custom UIPresentationController in custom ContainerViewController?

If we actually cannot do that, can I mimic the ContainerViewController behaviour with a custom UIViewController using presentViewController and setting the transitionDelegate of the ChildViewController/PresentedViewController to the CustomViewController. Combining with the PresentationController, can I achieve the same behaviour as addChildViewController?

seedante commented 8 years ago

Creating Custom Presentations in View Controller Programming Guide for iOS

UIKit provides presentation controllers for the standard presentation styles. When you set the presentation style of a view controller to UIModalPresentationCustom and provide an appropriate transitioning delegate, UIKit uses your custom presentation controller instead.

If you want to use UIPresentationController in the display process of a view controller, you need to present the view controller with a method like presentViewController:animated:completion:.

addChildViewController just create a parent-child relationship between two view controllers, it actually doesn't involve view controller transition.