How to show / hide UIView when clicking a button in iOS

I have UIViewadded to my xib file. Connect the inspector correctly.

In the viewDidLoad:method, I hide it and on some pressed button, showing it.

Here is my code:

.h file

@property (nonatomic, retain) IBOutlet UIView   *subView;

in viewDidLoad::

_subView.hidden = YES;

Hides this view correctly, but when you click a button, it does not appear.

- (IBAction)customerInvoice:(id)sender
{
//self->_subView.hidden = NO;
_subView.hidden = NO;
}

Using both methods, it does not appear. Please help me solve the problem.

+4
source share
2 answers

( xCode) IBOutlets/IBAction, , , , .

Apple , / IBOutlet, , , :

@property (nonatomic, weak) IBOutlet UIView *subView;
+3

:

  @property (weak, nonatomic) IBOutlet UIView *select_image_uiview;

"":

   - (IBAction)cancel_choose_view:(id)sender
 {
    _select_image_uiview.hidden=YES;
   }
0

Source: https://habr.com/ru/post/1530433/


All Articles