Uiswitch/uistepper
1 Overridefunc viewdidload () {2 super.viewdidload ()3 4Titlelabel.text =titlestring5 6 7 //Do any additional setup after loading the view.8 9 //To create a switch controlTenvar switchview:uiswitch = Uiswitch (Frame:cgrectmake ( -, -, -, +)) One A //Add to view - Self.view.addSubview (SwitchView) - the //set to open -Switchview.on =true - - //or +Switchview.seton (true, Animated:true) - + //Add uicontrolevents.valuechanged event to detect switch switching ASwitchview.addtarget (Self, Action:"Switchchange:", forControlEvents:UIControlEvents.ValueChanged) at - - - - //-------------------------- - in //Creating progressive controls -var stepperview:uistepper = Uistepper (Frame:cgrectmake ( $, -, the, +)) to + //Add to view - Self.view.addSubview (Stepperview) the * //set minimum value, default is 0.0 $Stepperview.minimumvalue = -Panax Notoginseng - //set maximum value, default is 100.0 theStepperview.maximumvalue = - + A //set current value, default is 0.0 theStepperview.value = - + - //sets the increment or decrement value, which is 1.0 by default $Stepperview.stepvalue = - $ } - - Overridefunc didreceivememorywarning () { the super.didreceivememorywarning () - //Dispose of any resources the can be recreated.Wuyi } the - Wu /* - //MARK:-Navigation About $ //In a storyboard-based application, you'll often want to do a little preparation before navigation - override func Prepareforsegue (segue:uistoryboardsegue!, sender:anyobject!) { - //Get The new view controller using Segue.destinationviewcontroller. - //Pass The selected object to the new view controller. A } + */ the - $ //switching events for the detection switch theFunc Switchchange (sender:anyobject?) the { the //var newswitch:uiswitch = sender as Uiswitch the - //Modified May 2, 2015 invar Newswitch:uiswitch = Sender as!Uiswitch the the println (Newswitch.on) About}
iOS Development--ui Article Swift &uiswitch/uistepper