IOS iOS8 new Features--uipresentationcontroller

Source: Internet
Author: User

1. The role of Uipresentationcontroller

1> manages all modal out of the controller

2> management Through this method-(void) Presentviewcontroller: (Uiviewcontroller *) Animated: (BOOL) completion:^ (void) completion; The controller shown

3> Management \ Monitor the process of switching controllers

2. The role of Uipresentationcontroller

1> Controller Once the present method is tuned, the controller's Presentationcontroller will be created first, then the entire controller switch is managed by Presentationcontroller

-(void) Touchesbegan: (Nsset *) touches withevent: (uievent *) event{

Secondviewcontroller *VC = [[Secondviewcontroller alloc]init];

[Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];

}

The 2> controller has 2 properties: Presentationcontroller and Poppverpresentationcontroller

The following scenario Vc.modalpresentationstyle = Uimodalpresentationformsheet, in which case poppverpresentationcontroller = Nil

3> set the controller to switch in Popver mode.

That is to say Vc.modalpresentationstyle = Uimodalpresentationpopover, the controller's Popoverpresentationcontroller attribute is no longer nil.

and Popoverpresentationcontroller and Presentationcontroller point to the same object, pointing to the Uipopoverpresentationcontroller class object

Note: The 1>uipopoverpresentationcontroller class inherits from the Uipresentationcontroller class

2> the parent class pointer can point to the subclass, so presentationcontroller points to the Uipopoverpresentationcontroller object, no problem

4> controller Presentationcontroller and Popoverpresentationcontroller adopt lazy loading way, the following code, VC controller is not popover out.

Secondviewcontroller *VC = [[Secondviewcontroller alloc]init];

//Presentationcontroller Get method was tuned before Vc.popoverPresentationController.sourceView = self.segmented

Vc.presentationcontroller;

Vc.modalpresentationstyle = Uimodalpresentationpopover;

Vc.popoverPresentationController.sourceView = self.segmented;

[Self PRESENTVIEWCONTROLLER:VC animated:yes completion:nil];

IOS iOS8 new Features--uipresentationcontroller

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.