IOS UIButton Common Properties

Source: Internet
Author: User

           //1. Add a buttonUIButton *nameview=[UIButton Buttonwithtype:uibuttontypecustom]; //Nameview.backgroundcolor=[uicolor Redcolor];[Nameview setbackgroundimage:[uiimage imagenamed:@"BUDDY_HEADER_BG"] Forstate:uicontrolstatenormal]; [Nameview setbackgroundimage:[uiimage imagenamed:@"buddy_header_bg_highlighted"] forstate:uicontrolstatehighlighted]; //set the left arrow image inside the button[Nameview setimage:[uiimage imagenamed:@"Buddy_header_arrow"] Forstate:uicontrolstatenormal];        [Nameview Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal]; //        //set the contents of the button to align left//Nameview.contenthorizontalalignment=uicontrolcontenthorizontalalignmentleft; //set the contents of the button to align leftNameview.contenthorizontalalignment =Uicontrolcontenthorizontalalignmentleft; //set the inner margin of a buttonNameview.titleedgeinsets=uiedgeinsetsmake (0,Ten,0,0); Nameview.contentedgeinsets=uiedgeinsetsmake (0,Ten,0,0);                [Nameview addtarget:self Action: @selector (Nameviewclick) forcontrolevents:uicontroleventtouchupinside]; //Center The content model of the ImageView inside the set buttonNameview.imageview.contentmode=Uiviewcontentmodecenter; //content beyond the border does not need to be croppednameview.imageview.clipstobounds=NO;        [Self.contentview Addsubview:nameview]; Self.nameview=Nameview; 

IOS UIButton Common Properties

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.