Suche…
Syntax
- (instancetype) initWithFrame: (CGRect) -Frame;
- (void) setOn: (BOOL) bei animiert: (BOOL) animiert;
- (nullfähiger Instanztyp) initWithCoder: (NSCoder *) aDecoder;
Bemerkungen
Ein / Aus einstellen
Ziel c
[mySwitch setOn:YES];
//or
[mySwitch setOn:YES animated:YES];
Schnell
mySwitch.setOn(false)
//or
mySwitch.setOn(false, animated: false)
Hintergrundfarbe einstellen
Ziel c
mySwitch.backgroundColor = [UIColor yellowColor];
[mySwitch setBackgroundColor: [UIColor yellowColor]];
mySwitch.backgroundColor =[UIColor colorWithRed:255/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
mySwitch.backgroundColor= [UIColor colorWithWhite: 0.5 alpha: 1.0];
mySwitch.backgroundColor=[UIColor colorWithHue: 0.4 saturation: 0.3 brightness:0.7 alpha: 1.0];
Schnell
mySwitch.backgroundColor = UIColor.yellow
mySwitch.backgroundColor = UIColor(red: 255.0/255, green: 0.0/255, blue: 0.0/255, alpha: 1.0)
mySwitch.backgroundColor = UIColor(white: 0.5, alpha: 1.0)
mySwitch.backgroundColor = UIColor(hue: 0.4,saturation: 0.3,brightness: 0.7,alpha: 1.0)
Tönungsfarbe einstellen
Ziel c
//for off-state
mySwitch.tintColor = [UIColor blueColor];
[mySwitch setTintColor: [UIColor blueColor]];
//for on-state
mySwitch.onTintColor = [UIColor cyanColor];
[mySwitch setOnTintColor: [UIColor cyanColor]];
Schnell
//for off-state
mySwitch.tintColor = UIColor.blueColor()
//for on-state
mySwitch.onTintColor = UIColor.cyanColor()
Bild für Ein / Aus einstellen
Ziel c
//set off-image
mySwitch.offImage = [UIImage imageNamed:@"off_image"];
[mySwitch setOffImage:[UIImage imageNamed:@"off_image"]];
//set on-image
mySwitch.onImage = [UIImage imageNamed:@"on_image"];
[mySwitch setOnImage:[UIImage imageNamed:@"on_image"]];
Schnell
//set off-image
mySwitch.offImage = UIImage(named: "off_image")
//set on-image
mySwitch.onImage = UIImage(named: "on_image")
Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow