IOS UIButton Use

Source: Internet
Author: User

Create:

UIButton *hongbao = [UIButton buttonwithtype:uibuttontypecustom];

Custom: Customize button

System: Seems to have an impact on the picture, not the normal picture displayed


Adjust position: These two functions have been adjusted for half a day: Note that the offset refers to the original position, not the distance from the button border, you can set a negative value, that is, moving in the opposite direction

[Hongbao Setimageedgeinsets:uiedgeinsetsmake (-15, 5, 0, 0)]; [Hongbao Settitleedgeinsets:uiedgeinsetsmake (50,-40, 0, 0)];

Parameter meaning: The parameter 1234 represents the pixel moving on the right and bottom left, the attention is on the original basis.

such as Uiedgeinsetsmake (10,0,10,0);


Set text size and color:

Hongbao.titleLabel.font = [Uifont systemfontofsize:14.0]; [Hongbao Settitlecolor:[uicolor Blackcolor]forstate:uicontrolstatenormal];


Event Response:

[Hongbao addtarget:self Action: @selector (Clickedhongbao) Forcontrolevents:uicontroleventtouchdown];



IOS UIButton Use

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.