Swift学习之UIButton
来源:互联网 发布:淘宝充话费多久到账 编辑:程序博客网 时间:2024/04/29 20:49
定义一个不可变的button以及触发方法的实现
//创建一个button
let button:UIButton =UIButton(type: .Custom)
//设置位置以及大小
button.frame =CGRectMake(10,150,100,30)
button.setTitle("普通状态", forState:UIControlState.Normal)
button.setTitle("触摸状态", forState:UIControlState.Highlighted)
button.setTitle("禁用状态", forState:UIControlState.Disabled)
//设置点击触发的方法
button.addTarget(self, action:Selector("clickButtonAction:"), forControlEvents: .TouchUpInside)
self.view.addSubview(button);
点击触发的方法实现
func clickButtonAction:() {
print("点击我了")
}
0 0
- Swift学习之UIButton
- Swift学习之UIButton
- swift之UIButton
- Swift基础之UIButton
- Swift UI学习之基础:UIButton,UILabel and UISlider
- Swift UI学习之基础:UIButton,UILabel and UISlider
- Swift UI学习之基础:UIButton,UILabel and UISlider
- Swift之贪婪的UIButton
- Swift之贪婪的UIButton
- Swift之贪婪的UIButton
- swift控件之旅之UIButton
- OC学习之UIButton
- IOS学习之UIButton
- IOS学习之UIButton
- Swift学习第六枪-UIButton和UILable
- [赵三哥Swift学习笔记]UIButton
- swift代码创建控件之UIButton
- 【swift系列之UIButton】简单使用
- hdoj5122K.Bro Sorting
- 设计模式系列9---和而不同的工厂方法模式
- 如何用PS制作动态下雪の效果
- GB2312编码
- Python学习笔记6-异常捕获取
- Swift学习之UIButton
- [BZOJ1010]玩具装箱
- IO_缓冲流_转换流_字节转为字符_乱码分析_编码与解码JAVA152-154
- 菜鸟初学android体验之——实现自定义简单标题栏的两种简单方法
- 依赖于数据库的web网站优化
- linux达人养成计划:Linux简介
- JUC之ReentrantReadWriteLock(JDK1.8源码)
- 欢迎使用CSDN-markdown编辑器
- GC 垃圾回收机制彻底理解