两个小Points

* dismissModalViewControllerAnimated *

dismiss 顺序问题:
A present B , B present C.
B 作为主体调用dismiss方法时,首先找自己作为presenter present出来的视图,将其dismiss掉。

/*
The next two methods are replacements for presentModalViewController:animated and dismissModalViewControllerAnimated: The completion handler, if provided, will be invoked after the presented controllers viewDidAppear: callback is invoked.
*/

@available(iOS 5.0, *)
public func presentViewController(viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?)

// The completion handler, if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked.
@available(iOS 5.0, *)
public func dismissViewControllerAnimated(flag: Bool, completion: (() -> Void)?)

* addChildViewController *

If the view belonging to a view controller is added to a view hierarchy directly, the view controller will not receive this message. If you insert or add a view to the view hierarchy, and it has a view controller, you should send the associated view controller this message directly. Failing to send the view controller this message will prevent any associated animation from being displayed

你可能感兴趣的:(iOS开发,ios开发)