Help with hiding a button

Discussion in 'iOS Programming' started by iAppleFan08, Mar 26, 2009.

  1. iAppleFan08 macrumors newbie

    Joined:
    Aug 26, 2008
    #1
    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.
     
  2. p.luik macrumors regular

    Joined:
    Jan 18, 2008
    Location:
    Faribault, MN
    #2
    Could you provide some more code, what language you are coding in, and some more details on your reasoning behind hiding the button?
     
  3. iAppleFan08 thread starter macrumors newbie

    Joined:
    Aug 26, 2008
    #3
    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.
     
  4. iphonedevelop18 macrumors member

    Joined:
    Feb 26, 2009
    #4
    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.
     
  5. iAppleFan08 thread starter macrumors newbie

    Joined:
    Aug 26, 2008
    #5
    That doesn't seem to work either... :(

    Maybe it's something stupid I did that I just can't seem to figure out.
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  7. iAppleFan08 thread starter macrumors newbie

    Joined:
    Aug 26, 2008
    #7
    I'm not getting errors. It builds just fine with no errors or warnings. It just doesn't DO it.
     
  8. NickFalk macrumors 6502

    NickFalk

    Joined:
    Jun 9, 2004
    #8
    Fairly basic question, but:
    Have you hooked up the correct IBOutlet to the button?
     
  9. Gottaa macrumors newbie

    Joined:
    Jan 28, 2009
    #9
    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 :)
     
  10. iAppleFan08 thread starter macrumors newbie

    Joined:
    Aug 26, 2008
    #10
    Let me try one more time and make sure everything is connected...
     
  11. iAppleFan08 thread starter macrumors newbie

    Joined:
    Aug 26, 2008
    #11
    It worked! It was a connecting problem (and something stupidly simple). Thank you for your help! :D
     

Share This Page