xcode--Code creation button, text input box

Source: Internet
Author: User

//Create buttonUIButton *btn =[[UIButton alloc] init]; Btn.frame= CGRectMake (0,0, -, -); //set the properties of the button in normal state//set a background pictureUIImage *normal = [UIImage imagenamed:@"Btn_01.png"];        [Btn Setbackgroundimage:normal Forstate:uicontrolstatenormal]; [BTN Settitle:@"dot me."Forstate:uicontrolstatenormal];    [btn Settitlecolor:[uicolor Greencolor] forstate:uicontrolstatenormal]; //set the properties of the button in the highlighted StateUIImage *high = [UIImage imagenamed:@"Btn_02.png"];        [Btn Setbackgroundimage:high forstate:uicontrolstatehighlighted]; [BTN Settitle:@"dot me."forstate:uicontrolstatehighlighted]; [btn Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatehighlighted];//Monitor button click[btn addtarget:self Action: @selector (Btnclick:) forcontrolevents:uicontroleventtouchupinside];- (void) Btnclick: (UIButton *) btn{NSLog (@ "———%"p,btn);}//Create a text input boxUitextfield *field =[[Uitextfield alloc] init]; Field.frame= CGRectMake ( -, -, -, -); Field.backgroundcolor=[Uicolor Redcolor];//The X of the midpointCGFloat CenterX = Self.view.frame.size.width *0.5; CGFloat CenterY= Self.view.frame.size.height *0.5' Field.center=Cgpointmake (CenterX, centery);//Set FontField.font = [Uifont systemfontofsize: -]; [Self.view Addsubview:field];

xcode--Code creation button, text input 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.