iOS about UIButton internal structure

Source: Internet
Author: User

1 1>UIButton Internal Default has a Uiimageview, Uilabel control, can be accessed by the following properties:2@property (Nonatomic,ReadOnly, retain) Uiimageview *ImageView;3@property (Nonatomic,ReadOnly, retain) UILabel *Titlelabel;4 5 2>UIButton's ability to display text is entirely due to its internal Titlelabel6 that is, UIButton's settitle:forstate: The string that the method sets is displayed on the Titlelabel7 8 3>UIButton's setimage:forstate: The image of the method setting is displayed on the internal ImageView9 Ten 4>Note One*To set the text or text color of a button, you must use the following method A- (void) Settitle: (NSString *) title forstate: (uicontrolstate) state; -- (void) Settitlecolor: (Uicolor *) Color forstate: (uicontrolstate) state; - #warnning can not directly get Titlelabel set text and text color, such as the following procedure is wrong: theButton.titleLabel.text =@"12323"; -Button.titleLabel.textColor =[Uicolor Redcolor]; -  -*To set a small image inside a button, you must use the following method +- (void) SetImage: (UIImage *) Image forstate: (uicontrolstate) state; - #warnning can not directly get ImageView to set up the picture, such as the following procedure is wrong: +Button.imageView.image = [UIImage imagenamed:@"Abc.png"];

iOS about UIButton internal structure

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.