简体   繁体   中英

Make UIButton disappear from UIViewController once a button in UIView is clicked

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!

yourButton.hidden=1; or [yourButton setHidden:1];
Instead of 1 you can use YES .
Do you mean this?

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.

Do you mean

buttonName.hidden = YES;

As you are in another class, hide it using NSNotificationCenter

Here is good example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM