IOS9 Warning Box

Source: Internet
Author: User

The use of the warning box in iOS9. The user name and password can be entered to achieve page interaction, the following is the entire code of Viewcontroller. Previous errors have not been removed to alert themselves.

1 #import "ViewController.h"2 3 @interfaceViewcontroller ()4@property (nonatomic, retain) uitextfield* user;//User name Input box5@property (nonatomic, retain) uitextfield* pwd;//Password Entry box6 @end7 8 @implementationViewcontroller9 Ten- (void) Viewdidload { One [Super Viewdidload]; ASelf.button = [[UIButton alloc] Initwithframe:cgrectmake (0, -, [[UIScreen mainscreen] Bounds].size.width, -)]; -[Self.button Settitle:@"Jump"Forstate:uicontrolstatenormal]; - [Self.button Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal]; the [Self.view AddSubview:self.button]; - [Self.button addtarget:self Action: @selector (ClickMe:) forcontrolevents:uicontroleventtouchupinside]; -  - }  +-(void) ClickMe: (ID) sender{ -      +     //Initialize the prompt box; AUialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@"Tips"Message@"Are you sure you want to unlock the lock"Preferredstyle:uialertcontrollerstylealert]; at[Alert addtextfieldwithconfigurationhandler:^ (Uitextfield *_nonnull TextField) { -Textfield.placeholder =@"Please enter user name"; - //UIView *myuserview = [[UIView alloc]initwithframe:cgrectmake (n , A, +)]; - //Myuserview.backgroundcolor = [Uicolor redcolor]; - //Self.user = [self createtextfield:@ "Please enter user name" - //Withframe:cgrectmake (a); in //[Myuserview AddSubview:self.user]; -     }]; to[Alert addtextfieldwithconfigurationhandler:^ (Uitextfield *_nonnull TextField) { +Textfield.placeholder =@"Please enter your password"; - //self.pwd = [self createtextfield:@ "Please enter password" the //Withframe:cgrectmake (a); *     }]; $[Alert addaction:[uialertaction Actionwithtitle:@"Cancel"Style:uialertactionstyledefault handler:^ (Uialertaction *_nonnull Action) {Panax Notoginseng         //Click on the button's response event; -NSLog (@"Cancel Prompt"); the     }]]; +[Alert addaction:[uialertaction Actionwithtitle:@"Yes"Style:uialertactionstyledefault handler:^ (Uialertaction *_nonnull Action) { A         //Click on the button's response event; theNSLog (@"Confirm Prompt"); +     }]]; -     //popup prompt box; $[Self Presentviewcontroller:alert animated:trueCompletion:nil]; $  - } - //-(uitextfield*) Createtextfield: (nsstring*) Placeholder withframe: (CGRect) Frame { the //uitextfield* field = [[Uitextfield alloc] initwithframe:frame]; - //field.placeholder = placeholder;Wuyi //field.securetextentry = YES; the //    //Field.backgroundcolor = [Uicolor redcolor]; - //field.contentverticalalignment = uicontrolcontentverticalalignmentcenter; Wu //     - //return field; About //} $- (void) didreceivememorywarning { - [Super didreceivememorywarning]; -     //Dispose of any resources the can be recreated. - } A  + @end
View Code

IOS9 Warning Box

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.