Self-learning iOS development small function Three: the two ways of the frame (iOS8.3 after the new way, previously deprecated)

Source: Internet
Author: User

1, the frame appears in the middle of the screen position

Uialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@"Tips"Message@"whether to exit"Preferredstyle:uialertcontrollerstylealert]; [Alert addaction:[uialertaction Actionwithtitle:@"Cancel"Style:uialertactionstylecancel Handler:nil]]; [Alert addaction:[uialertaction Actionwithtitle:@"Confirm"Style:uialertactionstyledestructive handler:^ (Uialertaction *_nonnull Action) {        //What to do when you click Confirm    }]]; [Self Presentviewcontroller:alert animated:yes completion:nil]; //Note that you must write this sentence, otherwise it will not show

This method can add a text box, enter the content

[Alert addtextfieldwithconfigurationhandler:^ (Uitextfield * _nonnull TextField) {        @ " Please enter a name ";    }];    [Alert Addtextfieldwithconfigurationhandler:^ (Uitextfield * _nonnull TextField) {        @ " Please enter the price " ;    }];

2, the frame appears at the bottom of the screen ( two different ways of the code is the first line of the last, the bottom is Uialertcontrollerstyleactionsheet)

1Uialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@"Tips"Message@"whether to exit"Preferredstyle:uialertcontrollerstyleactionsheet]; 2[Alert addaction:[uialertaction Actionwithtitle:@"Cancel"Style:uialertactionstylecancel Handler:nil]];3[Alert addaction:[uialertaction Actionwithtitle:@"Confirm"Style:uialertactionstyledestructive handler:^ (Uialertaction *_nonnull Action) {4         //What to do when you click Confirm5     }]];6[Self Presentviewcontroller:alert animated:yes completion:nil];//Note that you must write this sentence

Self-learning iOS development small function Three: the two ways of the frame (iOS8.3 after the new way, previously deprecated)

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.