IOS8 new Features (2)--uipopovercontroller

Source: Internet
Author: User

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

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.