First, modal and push
Modal from below to cover the original controller, generally the previous controller and the next controller is not associated with modal, such as the contact's plus jump page, any controller can be used modal
Push is generally used when the context is associated with a navigation controller (such as a universal Jump page setting the interface) to use the push
A controller modal out the B controller, then a controller will strongly reference B, if not strong reference, unable to process B business logic (such as click button to answer a), will report the wild pointer error
//Modal Another interface-(Ibaction) Modal: (ID) Sender {//Create a modal controllerOneviewcontroller *ONEVC =[[Oneviewcontroller alloc] init]; //Add the view of the newly created Controller to the windowUIWindow *keywindow =[UIApplication Sharedapplication].keywindow; [Keywindow AddSubview:oneVc.view]; //animation from bottom to top//first let the ONEVC view appear at the bottom of the windowOneVc.view.transform = Cgaffinetransformmaketranslation (0, KeyWindow.bounds.size.height); //animation, moving upwards, restoring deformation//[UIView animatewithduration:0.5 animations:^{// //Reduction Deformation// //cgaffinetransformidentity clears all the deformations, all the deformation parameters are 0 .//oneVc.view.transform = cgaffinetransformidentity;//} completion:^ (BOOL finished) {//SELF.PRESENTEDVC = ONEVC;// }]; //a controller MODALB controller, b controller will be strongly referenced by a controller//modal a controller[Self PRESENTVIEWCONTROLLER:ONEVC animated:yes completion:^{ }]; }//modal: The new controller's view is added to the window, but the window's root controller is not modified//modal: Will be the new controller strong reference, who modal, who is strong reference, why to strong reference, if not strong reference, the newly created controller will be destroyed, can not handle the modal out of the interface business logic.
Close the modal out of the controller
-(Ibaction) Dismiss: (ID) sender { // modal out who, who can dismiss [self Dismissviewcontrolleranimated:yes Completion:nil]; }
iOS Development--ui Advanced Chapter (14) modal