I have a UIViewController (JDTHViewController) with a UIView (JDTHMainMenu) In the view controller are two buttons that each, once clicked, move to two other separate view controllers. In the UIView are two other buttons (options and stats) that, once clicked, create subviews on top of the view, minus a few pixels from each side, and therefore hide the two buttons so you can interact with the subviews. Now when I run the simulator all my buttons are in the right positions but once one of the UIViews buttons are clicked they disappear and the segue buttons (ViewController switch buttons) are on top of my subviews. I need these to disappear once 'options' or 'stats' is clicked. Is there a way to do this? I hope that made sense if not i'll post more info or code. Thanks!
Asked
Active
Viewed 675 times
0
-
`buttonName.hidden = YES;` – Fahim Parkar Apr 08 '14 at 13:43
-
right but one buttons code is in the ViewController and the other is in the UIView, how would I reference a button made in the ViewController in the UIView to hide it? – JonHerbert Apr 08 '14 at 13:47
3 Answers
0
yourButton.hidden=1;
or [yourButton setHidden:1];
Instead of 1
you can use YES
.
Do you mean this?

nicael
- 18,550
- 13
- 57
- 90
-
2For ObjectiveC `BOOL` type argument you should pass `YES` or `NO`. Avoid passing `int` values. – Amar Apr 08 '14 at 14:09
0
Create a delegate callback from the UIView to the viewController and hide it. If you want to hide two buttons at the same time sending a notification would be easier.

rustylepord
- 5,681
- 6
- 36
- 49
-1
Do you mean
buttonName.hidden = YES;
As you are in another class, hide it using NSNotificationCenter

Community
- 1
- 1

Fahim Parkar
- 30,974
- 45
- 160
- 276
-
I think you and Nicael are right, but its where to put it when referencing a viewcontroller from a uiview – JonHerbert Apr 08 '14 at 13:55
-
@JonHerbert : hmm, use [NSNotificationCenter](http://stackoverflow.com/a/2191802/1066828) – Fahim Parkar Apr 08 '14 at 13:57
-
I'm reading through it and trying to understand it, to see how i'll apply it to my situation – JonHerbert Apr 08 '14 at 14:25
-
@JonHerbert : wokay... If you have any difficulty let me know... the link I gave is the easiest example ever I have... – Fahim Parkar Apr 08 '14 at 14:28