I. Previous use of Uipopovercontroller
are used only on ipad
1 /**2 * Uipopovercontroller can only be used on ipad, on, iphone use will crash3 */4-(void) Old5 {6VC2 *VC =[[VC2 alloc]init];7 8 Uipopovercontroller*popover =[[Uipopovercontroller ALLOC]INITWITHCONTENTVIEWCONTROLLER:VC];9 [PopOver presentpopoverfromrect: self.btn.bounds inView:self.btn permittedarrowdirections: Uipopoverarrowdirectionany Animated:yes];Ten}
Second, the Unified way:
1-(void)New2 {3VC2 *VC =[[VC2 alloc]init];4 5 //The following three lines of code will be ignored in the iphone6 //but on the ipad, we're present as present a popover.7 //so it's a good way to co-exist with the iphone and ipad.8Vc.Modalpresentationstyle=Uimodalpresentationpopover;9Vc.Popoverpresentationcontroller.sourcerect=self.btn.bounds;TenVc.Popoverpresentationcontroller.sourceview=self.btn; One A [Self presentviewcontroller: VC animated:yes Completion:nil]; -}
IOS8 new Features (2)--uipopovercontroller