swift2.0 UIButton

swift2.0 UIButton,第1张

概述var btn9:UIButton = UIButton(frame: CGRect(x: 50, y: 420, width: 100, height: 35))         btn9.backgroundColor = UIColor.whiteColor()         btn9.setTitle("边框按钮", forState: UIControlState.Normal)  

var btn9:UIbutton = UIbutton(frame: CGRect(x: 50,y: 420,wIDth: 100,height: 35))

btn9.backgroundcolor = UIcolor.whitecolor()

btn9.setTitle("边框按钮",forState: UIControlState.normal)

btn9.setTitlecolor(UIcolor.blackcolor(),forState: UIControlState.normal)

btn9.layer.bordercolor = UIcolor.blackcolor().CGcolor

btn9.layer.borderWIDth = 1
btn9.layer.cornerRadius = 5
给按钮添加图片:
btn3.setimage(UIImage(named: "btn1"),forState: UIControlState.normal)

添加点击事件

logout_bt.addTarget(self,action:"logoutAction",forControlEvents: .touchUpInsIDe)

写对应的方法

func logoutAction(){

print("退出账号")

}


shareBt.Alpha = 0.0//隐藏按钮

shareBt.enabled = false//让按钮不能点击


学习 :http://zhIDao.baIDu.com/link?url=2fAetLQQjf0hrzIHolK1KcdO472ORvvUW_fL--H_pP3zyt1qTdPdroYYVDJ9o89_mF80V5PG80JwrI0ofdUPJ_1XonkV8SXCbfKR5GrXajy 总结

以上是内存溢出为你收集整理的swift2.0 UIButton全部内容,希望文章能够帮你解决swift2.0 UIButton所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1071829.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存