UISwitch 的详细使用
代码如下:
let switch = UISwitch()
switch.frame = CGRectMake(10,230,200,30)
switch.center = CGPoint(30,400)
switch.on = true
switch.addTarget(self,action:Selector("switchDidChange"),forControlEvents:UIControlEvents.ValueChanged)self.view.addSubview(uiswitch)
//MARK
func switchDidChange(sender:UISwitch){
let open = sender.on
}
网友评论