[iOS base Control-3.1] QQ Landing Interface

Source: Internet
Author: User

A.storyboard control version 1.label2.textfield a.keyboard Type account: Number Pad Password: number and punctuation B.pla Ceholder: Hint text c.clear button:appears with editing clear button d.secure text Entry: password format input 3.button
1 @interfaceViewcontroller ()2@property (Weak, nonatomic) Iboutlet Uitextfield *Qqfield;3@property (Weak, nonatomic) Iboutlet Uitextfield *Pwdfield;4 5-(ibaction) login;6 7 @end8 9 @implementationViewcontrollerTen  One- (void) Viewdidload { A [Super Viewdidload]; -     //additional setup after loading the view, typically from a nib. - } the  -- (void) didreceivememorywarning { - [Super didreceivememorywarning]; -     //Dispose of any resources the can be recreated. + } -  +-(ibaction) Login { ANSLog (@"%@ - %@", Self.qqField.text, self.pwdField.text); at } - @end
B. Creating a button through code
1 @interfaceViewcontroller ()2 3- (void) AddLabel;4- (void) Addtextfield;5- (void) Addloginbutton;6- (void) login;7 8 @end9 Ten @implementationViewcontroller One  A- (void) Viewdidload { - [Super Viewdidload]; -     //additional setup after loading the view, typically from a nib. the     - [self addlabel]; - [self Addtextfield]; - [self Addloginbutton]; + } -  +- (void) didreceivememorywarning { A [Super didreceivememorywarning]; at     //Dispose of any resources the can be recreated. - } -  -- (void) AddLabel { -UILabel *titlelabel = [[UILabel alloc] Initwithframe:cgrectmake (0, $, Self.view.frame.size.width, +)]; - [Titlelabel Settextalignment:nstextalignmentcenter]; inTitlelabel.text =@"QQ Landing Interface 2"; - [Self.view Addsubview:titlelabel]; to     +UILabel *qqlabel = [[UILabel alloc] Initwithframe:cgrectmake ( -, the, -, +)]; -Qqlabel.text =@"QQ"; the [Self.view Addsubview:qqlabel]; *     $UILabel *pwdlabel = [[UILabel alloc] Initwithframe:cgrectmake ( -,131, the, +)];Panax NotoginsengPwdlabel.text =@"Password"; - [Self.view Addsubview:pwdlabel]; the } +  A- (void) Addtextfield { theUitextfield *qqfield = [[Uitextfield alloc] Initwithframe:cgrectmake (109, the,151, -)]; +Qqfield.placeholder =@"Please enter QQ account number"; - [Qqfield setclearbuttonmode:uitextfieldviewmodewhileediting]; $ [Qqfield Setkeyboardtype:uikeyboardtypenumberpad]; $ [Qqfield Setborderstyle:uitextborderstyleroundedrect]; -[Qqfield Settag:1]; - [Self.view Addsubview:qqfield]; the     -Uitextfield *pwdfield = [[Uitextfield alloc] Initwithframe:cgrectmake (109,127,151, -)];WuyiPwdfield.placeholder =@"Please enter the QQ password"; the [Pwdfield Setsecuretextentry:yes]; - [Pwdfield setkeyboardtype:uikeyboardtypenumbersandpunctuation]; Wu [Pwdfield setclearbuttonmode:uitextfieldviewmodewhileediting]; - [Pwdfield Setborderstyle:uitextborderstyleroundedrect]; About[Pwdfield Settag:2]; $ [Self.view Addsubview:pwdfield]; - } -  -- (void) Addloginbutton { A     //Note If you use Uibuttontypecustom, the default background color and Titlecolor are white and do not show +UIButton *loginbutton =[UIButton Buttonwithtype:uibuttontypesystem]; the     -CGRect Loginrect = CGRectMake (145,177, -, -); $Loginbutton.frame =Loginrect; the[Loginbutton Settitle:@"Login"Forstate:uicontrolstatenormal]; the [Loginbutton addtarget:self action: @selector (login) forcontrolevents:uicontroleventtouchupinside]; the     the [Self.view Addsubview:loginbutton]; - } in  the #pragmaMark-action the- (void) Login { AboutUitextfield *qqfield = [Self.view viewwithtag:1]; theUitextfield *pwdfield = [Self.view viewwithtag:2]; the     theNSLog (@"Login---->%@-%@", Qqfield.text, pwdfield.text); + } - @end

[iOS base Control-3.1] QQ Landing Interface

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.