美文网首页
UIButton的常见设置

UIButton的常见设置

作者: Hevin_Chen | 来源:发表于2016-09-18 20:12 被阅读55次

@property(nonatomic,readonly) UIView *superview;

// 获得自己的父控件对象

// 获得自己的所有子控件对象

@property(nonatomic,readonly,copy) NSArray *subviews;

@property(nonatomic) NSInteger tag;

// 控件的ID(标识),父控件可以通过tag来找到对应的子控件

- @property(nonatomic) CGAffineTransform transform;

// 控件的形变属性(可以设置旋转角度、比例缩放、平移等属性)

- (void)addSubview:(UIView *)view;

//  添加一个子控件view

- (void)removeFromSuperview;

// 从父控件中移除

- (UIView *)viewWithTag:(NSInteger)tag;

// 根据一个tag标识找出对应的控件(一般都是子控件)

@property(nonatomic) CGRect frame;

//  控件矩形框在父控件中的位置和尺寸(以父控件的左上角为坐标原点)

@property(nonatomic) CGRect bounds;

//  控件矩形框的位置和尺寸(以自己左上角为坐标原点,所以bounds的x、y一般为0)

@property(nonatomic) CGPoint center;

// 控件中点的位置(以父控件的左上角为坐标原点)

- (void)setTitle:(NSString *)title forState:(UIControlState)state;

// 设置按钮的文字

- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;

// 设置按钮的文字颜色

- (void)setImage:(UIImage *)image forState:(UIControlState)state;

// 设置按钮内部的小图片

- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;

// 设置按钮的背景图片

- (void)setTitle:(NSString *)title forState:(UIControlState)state;

// 设置按钮的文字

- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;

// 设置按钮的文字颜色

- (void)setImage:(UIImage *)image forState:(UIControlState)state;

// 设置按钮内部的小图片

- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;

// 设置按钮的背景图片

相关文章

网友评论

      本文标题:UIButton的常见设置

      本文链接:https://www.haomeiwen.com/subject/zojgettx.html