Uiswitch (switch, off by default)
iOS development is essential to the basic control, mainly for only two choices, such as flight patterns and so on, this article is mainly to list the commonly used properties and methods (note Xcode version 7.2)
Default state
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7B/73/wKiom1bNfYuiZN_8AAAaOmBnU4o454.png "style=" float: none; "title=" Simulator screen Shot February 24, 2016 PM 5.52.45.png "alt=" Wkiom1bnfyuizn_8aaaaombnu4o454.png "/>650) this.width=650, "src=" Http://s2.51cto.com/wyfs02/M02/7B/73/wKiom1bNfYyz2etpAAAauxAC03U053.png "style=" Float:none ; "title=" Simulator screen Shot February 24, 2016 PM 5.52.49.png "alt=" Wkiom1bnfyyz2etpaaaauxac03u053.png "/>
Property
@property (nullable, nonatomic, strong) Uicolor *ontintcolor ;//The color of the control when it is open
code: one. Ontintcolor =[uicolor browncolor];
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7B/73/wKioL1bNf2bQ2gOYAAAaFU3l5Zs243.png "title=" Simulator screen Shot February 24, 2016 afternoon 5.58.33.png "alt=" Wkiol1bnf2bq2goyaaaafu3l5zs243.png "/>650) this.width=650;" Src= "Http://s3.51cto.com/wyfs02/M01/7B/74/wKiom1bNftzi1ButAAAas7pzmKw309.png" title= "Simulator screen Shot February 24, 2016 afternoon 5.58.36.png "alt=" Wkiom1bnftzi1butaaaas7pzmkw309.png "/>
@property (null_resettable, nonatomic, strong) Uicolor *tintcolor ;//feel like the color of the border, and with animation,
code: one. Tintcolor =[uicolor redcolor];
The second one is like an animation.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7B/91/wKiom1bNn9DjRj_IAAAYPeVwCT4979.png "title=" Simulator screen Shot February 24, 2016 afternoon 8.18.08.png "alt=" Wkiom1bnn9djrj_iaaaypevwct4979.png "/>650) this.width=650;" Src= "Http://s3.51cto.com/wyfs02/M01/7B/91/wKiom1bNn_bzuFSmAAAY4vifl2U902.png" title= "Simulator screen Shot February 24, 2016 afternoon 8.19.36.png "alt=" Wkiom1bnn_bzufsmaaay4vifl2u902.png "/>
@property (nullable, nonatomic, strong) Uicolor *thumbtintcolor ;//The Color of the button
Code:
One . Thumbtintcolor =[uicolor bluecolor];
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7B/91/wKioL1bNos_gg5lXAAAa2ogvueo294.png "title=" Simulator screen Shot February 24, 2016 afternoon 8.30.11.png "alt=" Wkiol1bnos_gg5lxaaaa2ogvueo294.png "/>
@property (nonatomic,getter=ison) BOOL on;//is turned on, default is no
Method
-(instancetype) initWithFrame: ( CGRect ) frame ; //Set the size and start position of the control
-(nullable instancetype) Initwithcoder: ( Nscoder *) Adecoder ;//load from Xib
-(void) setOn: ( BOOL ) on animated: (BOOL) animated; //Whether there is an animation when it is opened
This article is from the "Red Corner Antelope" blog, please be sure to keep this source http://2254359459.blog.51cto.com/10776102/1744776
The Uiswitch of ios-ui-basic control