I'm trying to delete or hide a section inside a tableview with static cells on it. I am trying to hide it in function viewDidLoad
. Here is the code:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView beginUpdates];
[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:YES];
[self.tableView endUpdates];
[self.tableView reloadData];
}
Still the sections appear. I am using storyboards in it. Can you please help me out?Thanks!
I found it most convenient to hide sections by overriding numberOfRowsInSection.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if ( section == 1 )
// Hide this section
return 0;
else
return [super tableView:self.tableView numberOfRowsInSection:section];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With