您的位置:首页 > 产品设计 > UI/UE

UIbutton

2015-11-20 17:22 417 查看
一:初始化

UIButton的初始化一般使用其类方法,+ (id)buttonWithType:(UIButtonType)buttonType;

枚举类型

//用户自定义,无风格
UIButtonTypeCustom = 0,
//系统默认风格
UIButtonTypeSystem NS_ENUM_AVAILABLE_IOS(7_0),

UIButtonTypeDetailDisclosure,
UIButtonTypeInfoLight,
UIButtonTypeInfoDark,
//创建+号按钮
UIButtonTypeContactAdd,
//废弃
UIButtonTypeRoundedRect = UIButtonTypeSystem,
};


二属性设置

set方法
四一些获取方法

- (NSString *)titleForState:(UIControlState)state;
- (UIColor *)titleColorForState:(UIControlState)state;
- (UIColor *)titleShadowColorForState:(UIControlState)state;
- (UIImage *)imageForState:(UIControlState)state;
- (UIImage *)backgroundImageForState:(UIControlState)state;
- (NSAttributedString *)attributedTitleForState:(UIControlState)state NS_AVAILABLE_IOS(6_0);


只读属性

@property(nonatomic,readonly,retain) NSString *currentTitle;
@property(nonatomic,readonly,retain) UIColor  *currentTitleColor;
@property(nonatomic,readonly,retain) UIColor  *currentTitleShadowColor;
@property(nonatomic,readonly,retain) UIImage  *currentImage;
@property(nonatomic,readonly,retain) UIImage  *currentBackgroundImage;
@property(nonatomic,readonly,retain) NSAttributedString *currentAttributedTitle NS_AVAILABLE_IOS(6_0);

@property(nonatomic,readonly,retain) UILabel     *titleLabel NS_AVAILABLE_IOS(3_0);
@property(nonatomic,readonly,retain) UIImageView *imageView  NS_AVAILABLE_IOS(3_0);


btn最重要的触发事件由于其是继承的uicontrol,不描述
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: