Andrea F
Andrea F

Reputation: 733

Revealing a tableView on button press - iOS

I'm trying to reveal a UITableView if you click a certain button on my UIViewController.

I thought I could simply write:

- (void)viewDidLoad
{
    [super viewDidLoad];

    table.hidden=YES;
}

-(IBAction)task:(id)sender{

    table.hidden = NO;
}

That doesn't seem to work. I've added the tableView to a Xib and connected it. Anyone know how to do this?

Upvotes: 0

Views: 81

Answers (1)

Jai Govindani
Jai Govindani

Reputation: 3211

If you're creating the tableView in a XIB file then set the hidden property there. When your view loads from the XIB file I believe those settings take precedence (and default setting in XIB is hidden = NO). So select the tableView in your XIB file and set the hidden property (it's a checkbox). Then remove the table.hidden = YES line in your viewDidLoad and you should be good to go.

Upvotes: 1

Related Questions