IOS UIButton六种按钮

IOS UIButton六种按钮_第1张图片
image.png

contactAdd
infoLight
infoDark
System
detailDisclosure
Custom

代码创建UIButton

self.btn1Test = UIButton.init(type:UIButtonType.custom)
self.btn1Test?.setTitle(“我是btn1”, for:UIControlState.highlighted)38 self.btn1Test?.frame = CGRect(x:10, y:10, width:50, height:40)
self.btn1Test?.backgroundColor = UIColor.red
self.view .addSubview(self.btn1Test!)

self.btnTest.adjustsImageWhenHighlighted=false //使触摸模式下按钮也不会变暗
self.btnTest.adjustsImageWhenDisabled=false //使禁用模式下按钮也不会变暗

你可能感兴趣的:(IOS UIButton六种按钮)