UIButton头文件学习
来源:互联网 发布:淘宝外围活动流量大吗 编辑:程序博客网 时间:2024/06/05 13:22
UIButtonType枚举:
UIButtonTypeCustom 自定义按钮类型
UIButtonTypeSystem NS_ENUM_AVAILABLE_IOS(7_0), 系统按钮类型
UIButtonTypeDetailDisclosure, 蓝色小箭头按钮
UIButtonTypeInfoLight, 亮色感叹号
UIButtonTypeInfoDark, 暗色感叹号
UIButtonTypeContactAdd, 十字加号按钮
UIButtonTypeRoundedRect = UIButtonTypeSystem, 已过时,使用UIButtonTypeSystem替代
UIButton继承体系:
UIButton -> UIControl ->UIView
常用的属性:
@property(nonatomic) UIEdgeInsets contentEdgeInsetsUI_APPEARANCE_SELECTOR; 按钮内容间距
@property(nonatomic) UIEdgeInsets titleEdgeInsets; 按钮标题间距
@property(nonatomic) BOOL reversesTitleShadowWhenHighlighted; 标题的阴影改变时,按钮是否高亮显示。默认为NO
@property(nonatomic) UIEdgeInsets imageEdgeInsets; 按钮图片间距
@property(nonatomic) BOOL adjustsImageWhenHighlighted; 按钮高亮的情况下,图像的颜色是否要加深一点。默认是YES
@property(nonatomic) BOOL adjustsImageWhenDisabled; 按钮禁用的情况下,图像的颜色是否要加深一点。默认是YES
@property(nonatomic) BOOL showsTouchWhenHighlighted__TVOS_PROHIBITED;按下按钮是否会发光。默认是NO
- (void)setTitle:(nullableNSString *)title forState:(UIControlState)state; // default is nil. title is assumed to be single line
- (void)setTitleColor:(nullableUIColor *)color forState:(UIControlState)stateUI_APPEARANCE_SELECTOR; // default if nil. use opaque white
- (void)setTitleShadowColor:(nullableUIColor *)color forState:(UIControlState)stateUI_APPEARANCE_SELECTOR; // default is nil. use 50% black
- (void)setImage:(nullableUIImage *)image forState:(UIControlState)state; // default is nil. should be same size if different for different states
- (void)setBackgroundImage:(nullableUIImage *)image forState:(UIControlState)stateUI_APPEARANCE_SELECTOR; // default is nil
- (void)setAttributedTitle:(nullableNSAttributedString *)title forState:(UIControlState)stateNS_AVAILABLE_IOS(6_0);// default is nil. title is assumed to be single line
获取按钮不同状态下外观的一系列方法(get)
- (nullableNSString *)titleForState:(UIControlState)state; // these getters only take a single state value
- (nullable UIColor *)titleColorForState:(UIControlState)state;
- (nullable UIColor *)titleShadowColorForState:(UIControlState)state;
- (nullable UIImage *)imageForState:(UIControlState)state;
- (nullable UIImage *)backgroundImageForState:(UIControlState)state;
- (nullable NSAttributedString *)attributedTitleForState:(UIControlState)stateNS_AVAILABLE_IOS(6_0);
获取按钮当前状态下的一系列属性(get)
@property(nullable,nonatomic,readonly,strong)NSString *currentTitle; // normal/highlighted/selected/disabled. can return nil
@property(nonatomic,readonly,strong)UIColor *currentTitleColor; // normal/highlighted/selected/disabled. always returns non-nil. default is white(1,1)
@property(nullable,nonatomic,readonly,strong)UIColor *currentTitleShadowColor; // normal/highlighted/selected/disabled.
@property(nullable,nonatomic,readonly,strong)UIImage *currentImage; // normal/highlighted/selected/disabled. can return nil
@property(nullable,nonatomic,readonly,strong)UIImage *currentBackgroundImage; // normal/highlighted/selected/disabled. can return nil
@property(nullable,nonatomic,readonly,strong)NSAttributedString *currentAttributedTitleNS_AVAILABLE_IOS(6_0); // normal/highlighted/selected/disabled. can return nil
- UIButton头文件学习
- 头文件学习
- Algorithm头文件学习
- ELF头文件学习
- UIView头文件学习
- UIWindow头文件学习
- UIWebView头文件学习
- UIControl头文件学习
- UITextView头文件学习
- UITextField头文件学习
- UIScrollView头文件学习
- UIActionSheet头文件学习
- UIAlertView头文件学习
- UITableViewCell头文件学习
- UIActivityViewController头文件学习
- UIActivity头文件学习
- UIActivityIndicatorView头文件学习
- C++头文件学习
- EXCEL使用记录
- AWS和Azure的比较(5)
- java加密与解密的艺术 -- 笔记
- 多线程小案例之龟兔赛跑
- block 简单理解
- UIButton头文件学习
- 使用Merge存储引擎实现 mysql分表
- AWS和Azure的比较(6)
- g++基础知识
- android 自定义下拉刷新动画效果
- mongodb 主从搭建
- linux vmstat详解
- st官网下载stm32固件库方法
- Lua string用法