Reputation: 12224
Sup fellas, so I have a navigation controller with a table view to which I am trying to add a tool bar, however, the way I have implemented it causes the very last row in the table to be hidden behind the tool bar. I will try to illustrate via pictures:
Table view scrolled to the bottom without tool bar:
Table view scrolled to the bottom with tool bar(notice how the last "Vendor" row is concealed behind the tool bar):
I was following this guide and this is what I ended up doing for my implementation:
As you can see I have a "View" instead of "Window" to work with. Here is the code I have for displaying the tool bar:
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:self.navigationController.view];
[self.view addSubview:toolbar];
[self.navigationController.view setFrame:self.view.frame];
}
It seems to me that I need to adjust the frame of the navigation controller frame to compensate for the tool bar being at the bottom. This is where I am stuck. How would I go about doing this? Any help appreciated!
Upvotes: 3
Views: 9320
Reputation: 39925
If you add the toolbar to the navigation controller, it will automatically resize itself. Just check this box in IB.
Upvotes: 4
Reputation: 163308
I've had a similar issue before.
You need to adjust the height of your UINavigationController
's view to be exactly 44 pixels less.
This should do it:
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:self.navigationController.view];
[self.navigationController.view setFrame:CGRectMake(self.view.frame.x, self.view.frame.y, self.view.frame.width, self.view.frame.height - 44.0f)];
[self.view addSubview:toolbar];
}
Upvotes: 4