美文网首页
swift UISwitch 详解

swift UISwitch 详解

作者: 我会回来的 | 来源:发表于2021-12-03 18:37 被阅读0次

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 

}

相关文章

网友评论

      本文标题:swift UISwitch 详解

      本文链接:https://www.haomeiwen.com/subject/wbxmxrtx.html