首页 > 其他 > 详细

UISwitch

时间:2015-11-19 12:35:17      阅读:274      评论:0      收藏:0      [点我收藏+]

创建Switch

let mySwitch = UISwitch(frame: CGRectMake(100,100,0,0))
mySwitch.tag = 101
self.view.addSubview(mySwitch)

开关与事件

mySwitch.on = false
mySwitch.addTarget(self, action: Selector("switchDidChange"), forControlEvents: UIControlEvents.ValueChanged)
func switchDidChange(){
    let swit = self.view.viewWithTag(101) as! UISwitch
    print(swit.on)
}

  

UISwitch

原文:http://www.cnblogs.com/spaceID/p/4976904.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!