|
楼主 |
发表于 2018-11-29 16:29:56
|
显示全部楼层
获取button 的属性方法
获取按钮当前标题
@property(nullable, nonatomic,readonly,strong) NSString *currentTitle;
获取按钮当前标题颜色
@property(nonatomic,readonly,strong) UIColor *currentTitleColor;
获取按钮当前阴影标题颜色
@property(nullable, nonatomic,readonly,strong) UIColor *currentTitleShadowColor;
获取按钮当前按钮内图像
@property(nullable, nonatomic,readonly,strong) UIImage *currentImage;
获取按钮当前标题背景图片
@property(nullable, nonatomic,readonly,strong) UIImage *currentBackgroundImage;
获取按钮当前标题富文本
@property(nullable, nonatomic,readonly,strong) NSAttributedString *currentAttributedTitle
@property(nullable, nonatomic,readonly,strong) UILabel *titleLabel NS_AVAILABLE_IOS(3_0);
@property(nullable, nonatomic,readonly,strong) UIImageView *imageView NS_AVAILABLE_IOS(3_0);
指定背景边界
- (CGRect)backgroundRectForBounds: (CGRect)bounds;
指定内容边界
- (CGRect)contentRectForBounds: (CGRect)bounds;
指定标题边界
- (CGRect)titleRectForContentRect: (CGRect)contentRect;
指定图片边界
- (CGRect)imageRectForContentRect: (CGRect)contentRect;
示例:
- (CGRect)imageRectForContentRect: (CGRect)bounds{
return CGRectMake(0.0, 0.0, 44, 44);
} |
|