Search code examples
iosobjective-cibaction

how to display and hide the container view on button click


I have a view controller which consists of a container view which is half of the screen size over an image view, which is initially hided. the container is embedded with the tableView. i have a button which on click will display the container view and on the second click it should hide

i have tried like this

- (IBAction)OnClickingIndicator:(id)sender {
    [self.childViewControllers[0] view].hidden = NO;
}  

it is getting displayed but to hide on second click how to do?


Solution

  • It will work fine for me.Please try it.

    - (IBAction)OnClickingIndicator:(id)sender {
        [self.childViewControllers[0] view].hidden = ![self.childViewControllers[0] view].hidden
       }