UIButton 方法以及属性

属性
contentEdgeInsets
//设置内边距

titleEdgeInsets   
//设置titleLabel的边界

reversesTitleShadowWhenHighLighted
//设置高亮时是否改变阴影的BOOL值

imageEdgeInsets
//设置imageView的边界

adjustsImageWhenHighLighted​                                                                                     

//按下button时,是否产生变化


adjustsImageWhenDisabled
//设置button不可用时是否产生变化

showsTouchWhenHighlighted
//设置button被点按时是否发光

tintColor
//该控件上的渲染颜色

buttonType
//按钮的样式

UIButtonTypeCustom = 0
//无样式

UIButtonTypeSystem
//设置为系统样式

UIButtonTypeDetailDisclosure
//详细信息样式 (被动加上一个感叹号)

UIButtonTypeInfoLight
//同上

UIButtonTypeInfoDark
//同上

UIButtonTypeContactAdd
//显示加号

UIButtonTypeRoundRect
//(被弃用的)请使用UIButtonTypeSystem样式

currentTitle
//当前应该显示的标题 (只读)

currentTitleColor
//当前应该显示的标题颜色 (只读)

currentTitleShadowColor
//当前应该显示的标题阴影颜色 (只读)

currentImage
//当前应该显示的图片 (只读)

currentBackgroundImage
//当前应该显示的背景图片 (只读)

currentAttributedTitle
//当前应该显示的带有属性的标题 (只读)

titleLabel
//按钮中显示的label显示的内容 (只读)  此属性与currentTitle有很大不同

imageView
//按钮中显示的imageView (只读) 此属性与currentImage有很大不同

实例方法
setTitle: forState:   //设置button 某状态下 的标题
setTitleColor: forState:
//设置button 某状态下的标题颜色

setTitleShadowColor: forState:
//设置某状态下标题的阴影颜色

setImage: forState:
//设置某状态下的图片

setBackgroundImage: forState:
//设置某状态下的背景图片

setAttributedTitle: forState:
//设置带有属性的title

titleForState:
//返回指定状态下的title(NSString *)注意,仅返回无属性的标题

titleColorForState:
//返回指定状态下title的颜色,(UIColor *)

titleShadowColorForState:
//返回指定状态下title阴影的颜色,(UIColor *)

imageForState:
//返回指定状态下的image ,(UIImage *)

backgroundImageForState:
//返回指定状态下的背景图片,(UIImage *)

attributedTitleForState:
//返回指定状态下的AttributedTitle,(NSAttributedString *)

backgroundRectForBounds
//(重绘)指定背景边界(请勿直接调用)

contentRectForBounds
//(重绘)指定内容边界(请勿直接调用)

titleRectForContentRect
//(重绘)指定文字标题边界(请勿直接调用)

imageRectForContentRect
//(重绘)指定按钮图像边界(请勿直接调用)
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值