views:

45

answers:

1

Hi

I am trying to create a series of buttons. Some of which hide behind each other. For example I have a play and a pause button which are located in the same area. If the play button is pressed then it is then hidden and the pause button is shown. And vice versa. This works fine however I also have another button which shows an UI alert view with several options to choose from. None of these options should affect the play/pause buttons. Now whenever I press the pause/play buttons after I have pressed the UI Alert view button I get an NSInvalidArgumentException. I tried debugging it and worked out that this happens when I try to hide the play button (ie. playbutton.hide).

I have no idea whatsoever why this is happening but if anyone can give me any hints it would be much appreciated.

+1  A: 

Instead of playbutton.hide, try using:

[playbutton setHidden:YES] or playButton.hidden = YES;
Tom Irving
My apologise I actually had it as the second one you mentioned there. I tried changing it to the setHidden method however it made no difference. I think it has something to do with not being able to hide the button with the UIAlert after it has been called (as if it is still running. if that makes sense? As I tried it again with my other UIAlert and had the same issue). I just don't really know how to solve that problem.Thanks for the quick response.
Chris G
Do you do anything when showing the UIAlertView which could be affecting the buttons at all?
Tom Irving
Not really I'm afraid. They are pretty much seperate. Just seems to be that when it enters the UIActionSheet for the other button, it jams up and wont allow that button to be hidden,I am new to objective c though so I could be completely misreading the situation.
Chris G
Could you post the relevant code? I might be able to get a better idea of what's going on.
Tom Irving
What do you have in the method which calls the UIActionSheet? And are you sure it's a UIActionSheet you're using and not a UIAlertView?
Tom Irving
I got it working... Turns out it was a problem with one of my boolean values elsewhere. A bit of a silly problem really. Thanks alot for all the help you gave me Tom, sorry for wasting your time with the issue.
Chris G
No problem! I'm glad you got it working!
Tom Irving
Thanks me too :)Btw I tried you're friendz app for the iPhone. Really like it. Going to recommend it to a few friends :)
Chris G