试图禁用按钮使用button.enabled =假,但有没有运气 [英] Trying to disable button using button.enabled = false, but having no luck
问题描述
我,因为我没能有超过我的栏按钮的项目或我的 UIToolbar
任何控制感到沮丧。我试图禁用的UIBarButtonItem
,但它仍然响应触摸事件。以下是我已经做了,code是如此简单,我不知道为什么它不工作。
I'm getting frustrated because I am failing to have any control over my bar button items or my UIToolbar
. I am trying to disable a UIBarButtonItem
, but it continues to respond to touch events. Here is what I have done, the code is so simple I don't know why it isn't working.
在我的.h:
IBOutlet UIBarButtonItem *button;
@property (nonatomic,retain) IBOutlet UIBarButtonItem *button;
和在.M:
@synthesize button;
-(void)function{
button.enabled = false;
}
我做得不对的代表的ViewController?我不明白为什么我没有得到任何回应。感谢您的帮助。
Am I doing something wrong with the viewcontroller delegate? I don't understand why I get no response. Thanks for your help.
推荐答案
这是正确的:
button.enabled = false;
所以,你确定这种方法实际上是被称为? (如果这是你的实际code,有一个名为功能?法)
So are you sure that this method is actually being called? (And if this is your actual code, you have a method called 'function'?)
这篇关于试图禁用按钮使用button.enabled =假,但有没有运气的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!