I\'ve got an iPhone application with a UITableView
menu. When a row in the table is selected, the appropriate view controller is pushed onto the application\'s
I am in agreement with Jeff's answer. But there is a UI glitch if I hide the toolbar in -viewDidAppear method of the viewController through which different viewControllers are pushed.
To avoid this, I was experimenting and found out that calling -setToolbarHidden in the -viewWillAppear call indeed hides the toolbar, but as the question states, the view though expanded would not be occupied by the tableview rows.
To fix this, I have changed to following code and now it works without the glitch:
- (void)viewDidLoad
{
[super viewDidLoad];
.
.
.
[self reframeRowHeight];
[self.menuItemTableView addObserver:self
forKeyPath:@"frame"
options:NSKeyValueObservingOptionNew
context:nil];
[self.menuItemTableView setBounces:NO];
.
.
.
}
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"frame"])
{
[self reframeRowHeight];
}
}
-(void)reframeRowHeight
{
[self.menuItemTableView setRowHeight:self.menuItemTableView.frame.size.height/self.menuItems.count];
[self.menuItemTableView reloadData];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
.
.
.
// Bad Apple! - http://stackoverflow.com/questions/2339721/hiding-a-uinavigationcontrollers-uitoolbar-during-viewwilldisappear
[self.navigationController setToolbarHidden:YES animated:YES];
.
.
.
}