- (instancetype)initWithFrame:(CGRect)frame;
+ (id)buttonWithType:(UIButtonType)buttonType;
1.设置标题
- (void)setTitle:(NSString *)title forState:(UIControlState)state;
2.设置标题颜色
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state
3.设置水平和垂直位置
setContentHorizontalAlignment
setContentVerticalAlignment
4.设置背景图片
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state
5.设置图片
- (void)setImage:(UIImage *)image forState:(UIControlState)state;
6.设置是否选中
setSelected:YES
7.设置事件监听
/**
* @brief 给按钮添加事件监听
* @param target :执行方法的对象
* @param acrion :执行方法
* @param events :触发执行方法的按钮行为
*/
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
UILabel:文本标签
- (instancetype)initWithFrame:(CGRect)frame;
text:设置显示文本
font:设置显示字体
textColor:设置字体显示颜色
shadowColor:设置阴影颜色
shadowOffset:设置阴影偏移量
numberOfLines:设置显示行数,0为无限制
textAlignment:设置文本对齐方式
lineBreakMode:设置文本换行方式
userInteractionEnabled:是否允许用户交互
/**
* @brief 获取字符串所占空间位置大小
*
* @param string : 指定字符串
* @param font : 字体类型
* @param constrainSize: 指定最大范围
*
* @return: 字符串所占位的大小
*/
- (CGSi