uiswitch

KVO not working with UISwitch

最后都变了- 提交于 2020-04-10 14:09:05
问题 For the life of me I can't get KVO working with UISwitch. I have a custom UITableViewCell with a UISwitch added through Interface Builder. I created an IBOutlet for the UISwitch and linked it to theSwitch variable. - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [theSwitch addObserver:self forKeyPath:@"on" options:NSKeyValueObservingOptionNew context:NULL]; } return self; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:

KVO not working with UISwitch

人走茶凉 提交于 2020-04-10 14:07:41
问题 For the life of me I can't get KVO working with UISwitch. I have a custom UITableViewCell with a UISwitch added through Interface Builder. I created an IBOutlet for the UISwitch and linked it to theSwitch variable. - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { [theSwitch addObserver:self forKeyPath:@"on" options:NSKeyValueObservingOptionNew context:NULL]; } return self; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:

Set the stroke color for a UISwitch when it's on?

杀马特。学长 韩版系。学妹 提交于 2020-03-26 05:34:26
问题 I have a UISwitch that needs to have the same style when it's on as when it's off. The only difference would be where the little circle is. It looks like this when it's off: … which is good. But when I turn it on, the stroke disappears: How do I make it keep the stroke when it's on? If that isn't possible, can I at least make it tinted when it's off and not just when it's on? 回答1: Apple may reject your app for not showing a different color for the On state, however I believe this is what you

Set the stroke color for a UISwitch when it's on?

守給你的承諾、 提交于 2020-03-26 05:33:55
问题 I have a UISwitch that needs to have the same style when it's on as when it's off. The only difference would be where the little circle is. It looks like this when it's off: … which is good. But when I turn it on, the stroke disappears: How do I make it keep the stroke when it's on? If that isn't possible, can I at least make it tinted when it's off and not just when it's on? 回答1: Apple may reject your app for not showing a different color for the On state, however I believe this is what you

Resize UISwitch in Swift 4

送分小仙女□ 提交于 2020-03-19 05:16:10
问题 I would like to change the default size of the UISwitch in Swift 4. I have looked at various options but they all relate to v3 and do not work. Please can someone suggest an example that does so programmatically in Swift 4? Thank you, Edit: I have tried the following examples: switchTest.transform = CGAffineTransformMakeScale(0.75, 0.75) switchTest.transform = CGAffineTransform(scaleX: 0.75, y: 0.75) UISwitch *switchTest = [UISwitch new]; switchTest.transform = CGAffineTransformMakeScale(0.75

Resize UISwitch in Swift 4

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-19 05:15:24
问题 I would like to change the default size of the UISwitch in Swift 4. I have looked at various options but they all relate to v3 and do not work. Please can someone suggest an example that does so programmatically in Swift 4? Thank you, Edit: I have tried the following examples: switchTest.transform = CGAffineTransformMakeScale(0.75, 0.75) switchTest.transform = CGAffineTransform(scaleX: 0.75, y: 0.75) UISwitch *switchTest = [UISwitch new]; switchTest.transform = CGAffineTransformMakeScale(0.75

Resize UISwitch in Swift 4

那年仲夏 提交于 2020-03-19 05:15:08
问题 I would like to change the default size of the UISwitch in Swift 4. I have looked at various options but they all relate to v3 and do not work. Please can someone suggest an example that does so programmatically in Swift 4? Thank you, Edit: I have tried the following examples: switchTest.transform = CGAffineTransformMakeScale(0.75, 0.75) switchTest.transform = CGAffineTransform(scaleX: 0.75, y: 0.75) UISwitch *switchTest = [UISwitch new]; switchTest.transform = CGAffineTransformMakeScale(0.75

iOS UISwitch用法和示例

删除回忆录丶 提交于 2020-02-29 14:09:47
iOS UISwitch用法和示例 ( class UISwitch (swift)) 动态创建UISwitch (代码中创建) E.X. Xcode 7.0.1 + Swift 2.1 3 步 1 在自己继承于UIViewController的VC中 例如在viewDidLoad E.X. override func viewDidLoad() { super.viewDidLoad() var c = CGPointMake(100.0, 64.0) self.savedUISwt = self.createUISwitch(centerAt: c, dftOn: true, onSwtChangeSelector: "onSwtChange:") c = CGPointMake(100.0, 128.0) self.savedUISwt2 = self.createUISwitch(centerAt: c, dftOn: false, onSwtChangeSelector: "onSwtChange2") self.view.addSubview(self.savedUISwt!) self.view.addSubview(self.savedUISwt2!) } 2 实现方法createUISwitch E.X. /* * NAME createUISwitch -

iOS UISwitch 用法总结

会有一股神秘感。 提交于 2020-02-28 23:41:33
iOS 系统开关控件简单使用总结: 初始化: - (instancetype)initWithFrame:(CGRect)frame; 这个frame是没有意义的,系统的开关控件大小是确定的。 设置开关开启状态时的颜色 @property(nonatomic, retain) UIColor *onTintColor; 设置开关风格颜色 @property(nonatomic, retain) UIColor *tintColor; 设置开关按钮颜色 @property(nonatomic, retain) UIColor *thumbTintColor; 设置开关开启状态时的图片(注意:在IOS7后不再起任何作用) @property(nonatomic, retain) UIImage *onImage; 设置开关关闭状态时的图片(注意:在IOS7后不再起任何作用) @property(nonatomic, retain) UIImage *offImage; 开关的状态 @property(nonatomic,getter=isOn) BOOL on; 手动设置开关状态 - (void)setOn:(BOOL)on animated:(BOOL)animated; 一点感想:iOS的系统的UISwitch控件虽然定制性很差,配合IOS7之后的扁平化和俭约的风格

UISwitch, something similar for Mac?

我的梦境 提交于 2020-01-11 15:30:25
问题 Im sure most of you are familiar with the UISwitch on iOS. Is their any existing project trying to implement something like this on Mac? If not, where would one start to make one? I see them frequently and can think of so many uses. Thanks in advance 回答1: I've used the Mondo Switch that's part of the Cocoa Mondo Kit. It works pretty well. 回答2: I think you should use NSCheckBox since it is the equivalent on a computer where you use a mouse and not your finger. 回答3: I recently extended Peter