iOS Development--ui Advanced Chapter (14) modal

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.