Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iAppleFan08

macrumors newbie
Original poster
Aug 26, 2008
25
0
It sounds simple and most people will probably take one look at this and think "how could you not get this?" but my problem is with simply hiding a button when I click it. The books I'm learning the code out of use many examples of button.hidden = YES; but it's not working in my app.
 
Could you provide some more code, what language you are coding in, and some more details on your reasoning behind hiding the button?
 
All I have for that action so far is

button.hidden = YES;

All I want is to hide the button once it's pressed. That's all I have going so far. I have the outlet, the interface button connected correctly, synthesized, and the action specified. I'm coding in Objective-C.
 
if you just want to disable it thats also an option as you can make it dissapear under the disabled design or whatever.

just say

button.enabled = FALSE;

and that will disable it.
 
That doesn't seem to work either... :(

Maybe it's something stupid I did that I just can't seem to figure out.
 
I'm not getting errors. It builds just fine with no errors or warnings. It just doesn't DO it.
 
Fairly basic question, but:
Have you hooked up the correct IBOutlet to the button?
 
As Nick says, is the IB outlet hooked into the interface builder ?

the IBOutlet needs defining in the .h, synthesizing in the .m then you should be able to link it to the button in the interface builder and then button.hidden = YES; will work. I know it works because I did it just this morning :)
 
It worked! It was a connecting problem (and something stupidly simple). Thank you for your help! :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.