[IOS series]-unconventional use of UIButton
This article mainly introduces the tips of UIButton in development, which can achieve amazing results. 1: Set the button padding attribute to display the effect btn of the photo frame. contentEdgeInsets = UIEdgeInsetsMake (CGFloat top, CGFloat left, CGFloat bottom, CGFloat right); 2: UIButton displays images and text (for small icons ), because UIButton has a special structure (including UIImageView and UILabel), we can present it in the following way. // 1: the first method is btn. enabled = NO; btn. adjustsImageWhenDisabled; // 2: The second method is btn. adjustsImageWhenHighlighted; 3: retrieve the UIButton attributes. You can not only set the attributes: setTitle, setImage... similarly, we can retrieve the corresponding property value based on the button status: // obtain the text of the button-(NSString *) titleForState :( UIControlState) state; // obtain the text color of the button-(UIColor *) titleColorForState :( UIControlState) state; // obtain the button image-(UIImage *) imageForState :( UIControlState) state; // obtain the background image of the button-(UIImage *) backgroundImageForSta Te :( UIControlState) state; if this is inconvenient, we can use the 'currenttitle, currentTitleColor, currentImage, and currentBackgroundImage attributes of UIButton to obtain the current attribute value.