另一个自定义 UISwitch 问题
我已经查看了整个堆栈溢出,为了这个问题的答案,我只能找到适用于 4.1 及更低版本的方法,但对于 4.2.1 及更高版本,我找不到获取 ON 文本的新方法和 OFF 进行更改。有没有办法改变它说是和否。 这就是我目前所拥有的:
UISwitch *switchControl = [[UISwitch alloc] initWithFrame:frame];
[switchControl addTarget:self action:action forControlEvents:UIControlEventValueChanged];
switchControl.backgroundColor = [UIColor clearColor];
switchControl.on = value;
[cell addSubview:switchControl];
[switchControl release];
改变 UISwitch 文本的最简单方法是什么?或者如果我制作两个图像并使用动画使它们流动会更容易,就像它是一个普通的 UISwitch 一样。
I have looked all over stack overflow, for the answer to this question, and i can only find ways which worked on 4.1 and below, but for 4.2.1 and above, i can't find a new way of getting the text of ON and OFF to change. Is there a way of changing it to say Yes and No.
This is what I have currently:
UISwitch *switchControl = [[UISwitch alloc] initWithFrame:frame];
[switchControl addTarget:self action:action forControlEvents:UIControlEventValueChanged];
switchControl.backgroundColor = [UIColor clearColor];
switchControl.on = value;
[cell addSubview:switchControl];
[switchControl release];
What would be the easiest way of changing the text of the UISwitch? Or would it be easier if i was to make two images and using animation to make them flow, like it is a normal UISwitch.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我编写了一个自定义开关类。希望这有帮助。 http://cl.ly/4OQN
编辑:
另外,也许可以尝试这个:
I wrote up a custom switch class. Hope this helps. http://cl.ly/4OQN
EDIT:
Also, maybe try this: