UISwitch Action方法 [英] UISwitch Action method

查看:55
本文介绍了UISwitch Action方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中有2个表视图,每个视图中有5个UISwitch.对于每个开关都有一个动作.现在我决定更改switch的标签文本.我能够将标签文本从ON_OFF更改为YES_NO.但是在一个单独的类(UISwitch类)中实现此方法后,我无法为该特定开关调用action方法.如果我没有实现此方法来更改标签文本,则同样可以正常工作.有人可以告诉我我要去哪里错了.

i have 2 tableviews in my application with 5 UISwitch in each view.For every switch there is an action.Now i decide to change the label text of switch.I was able to change the label text from ON_OFF to YES_NO . But after implementing this method in a seperate class which is a UISwitch class i am not able to call the action method for that particular switch.The same is working well if i doesn't implement this method to change the label text. Can anybody suggest me that were i am going wrong.

推荐答案

您应该发布一些实际的代码.特别是您如何更改标签文本.您是否使用未公开的API?UISwitch类参考明确指出它不可自定义.

You should post some actual code; particularly how you changed the label text. Are you using undocumented APIs? The UISwitch class reference specifically says it's not customizable.

当您说在作为UISwitch类的单独类中实现此方法"之类的事情时,您是说您已经将UISwitch子类化了吗?这也不被支持.这是一个笨拙的控件,如果不构建自己的控件,就无法做很多事情.

When you say things like "implementing this method in a seperate class which is a UISwitch class," do you mean you've subclassed UISwitch? This also isn't supported. It's a clunky control and there's not a lot that can be done about it without building your own.

这篇关于UISwitch Action方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆