UIButton 使用注意事项:
1 当UIButton结合Mansory使用时,注意使用
- (void)setBackgroundImage:(nullable UIImage *)image forState:(UIControlState)state
方法,
因为经由这个方法设置的图片会紧粘着UIButton的边界,也就是
@property(nonatomic) UIEdgeInsets contentEdgeInsets UI_APPEARANCE_SELECTOR; // default is
的属性将不能生效,且后期使用很麻烦;
所以,改用
- (void)setImage:(nullable UIImage *)image forState:(UIControlState)state;
则无此问题,这样就可以达到UIButton点击区域比image要大的效果。