Xcode Hide Buttons

I am curious to know if there is a way to edit what happens when the application starts to hide the buttons? I can hide them when the application is running, but I want some buttons to be hidden when the application starts and appears later after I touch one of my displayed buttons, is there any way to do this?

+7
source share
4 answers

In code

UIView has a hidden property. You can switch it to hide / show how you want in the code, for example:

 myView.hidden = YES; // YES/NO 

You will want to do this somewhere after -viewDidLoad

Interface constructor

In the inspector, once you have selected the view you want to hide, you should see something like this (look in the View> Drawing Options below).

This is a hidden property that you want to check here ... You will want to log out to your code in order to subsequently display it ...

enter image description here

+7
source

I assume that you mean the view that you created using the XIB (Interface Builder) file. If this is the case, just set the hidden flag on any buttons that you want to hide initially.

0
source

In -viewDidLoad just add something like yourButton.hidden = YES;

0
source

Initially, you can hide your buttons with the Attribute Inspector . There is a checkbox View -> Drawing -> Hidden to hide the button.

Then you can set the buttons visible when you touch another visible button, as shown below:

 #import "HBOSViewController.h" @interface HBOSViewController () // your buttons outlets here @property (weak, nonatomic) IBOutlet UIButton *topButton1; @property (weak, nonatomic) IBOutlet UIButton *topButton; @end @implementation HBOSViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } // The action of the visible button to make your hidden button visible. - (IBAction)showButton:(id)sender { if (self.topButton) { self.topButton.hidden=NO; } if (self.topButton1) { self.topButton1.hidden=NO; } } @end 
0
source

All Articles