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