1.

controller.modalTransitionStyle =UIModalTransitionStyleCoverVertical;

modalTransitionStyle

Discussion

This property determines how the view controller’s is animated onscreen when it is presented using thepresentViewController:animated:completion: method. To change the transition type, you must set this property before presenting the view controller. The default value for this property is UIModalTransitionStyleCoverVertical.

For a list of possible transition styles, and their compatibility with the available presentation styles, see the “Presentation Transition Styles”constant descriptions.

2.

presentModalViewController:animated:

Presents a modal view managed by the given view controller to the user. (Deprecated. Use presentViewController:animated:completion: instead.)

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
Parameters
modalViewController

The view controller that manages the modal view.

animated

If YES, animates the view as it’s presented; otherwise, does not.

Discussion

On iPhone and iPod touch devices, the view of modalViewController is always presented full screen. On iPad, the presentation depends on the value in themodalPresentationStyle property.

Sets the modalViewController property to the specified view controller. Resizes its view and attaches it to the view hierarchy. The view is animated according to the transition style specified in the modalTransitionStyle property of the controller in the modalViewController parameter.

3.

dismissViewControllerAnimated:completion:

Dismisses the view controller that was presented by the receiver.

- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
Parameters
flag

Pass YES to animate the transition.

completion

A block called after the view controller has been dismissed.

Discussion

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller.

If you present several view controllers in succession, thus building a stack of presented view controllers, calling this method on a view controller lower in the stack dismisses its immediate child view controller and all view controllers above that child on the stack. When this happens, only the top-most view is dismissed in an animated fashion; any intermediate view controllers are simply removed from the stack. The top-most view is dismissed using its modal transition style, which may differ from the styles used by other view controllers lower in the stack.

If you want to retain a reference to the receiver’s presented view controller, get the value in the presentedViewController property before calling this method.

The completion handler is called after the viewDidDisappear: method is called on the presented view controller.

如sdk中所说,

The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller.

所以当我把

dismissViewControllerAnimated:completion:

这个函数在presented viewController中调用时,效果跟在presenting viewController中调用是一样的

 

posted on 2012-11-14 20:09  凰浴浴的CodingBlog  阅读(833)  评论(0)    收藏  举报