Reputation: 41470
I have a UITableViewController and I want to add a navigation bar to it. So after the navigation bar (which works fine), part of the original tableView is being covered up by the nav bar.
I tried to reposition the table view using this:
self.tableView.frame = CGRectMake(0, 44 + 20 /* height of navbar + some margin */, 320, 416);
But the table won't position.
Upvotes: 0
Views: 531
Reputation: 21460
You COULD set the nav bar as the header view of the table view like this (assuming you have the nav bar in a property called navBar
):
self.tableView.tableHeaderView = self.navBar;
I am guessing this isn't what you want though (since the nav bar will scroll off when you scroll down the table).
Instead, you could change to a normal view controller & put the nav bar & a table view on its view (laid out however you want). You can add your own tableView property for the table view & make its data source & delegate your view controller & everything you have now should work just fine.
Upvotes: 0
Reputation: 728
self.tableView.frame
doesn't work for me either, it throws an error, but
tableView
in IB
IBOUTLET UITableView *myTabli;
FileOwner
and tableView > myTabli
in IB
myTabli.frame = CGRectframe(x,y,width,height);
in the m-Fileworks for me.
Upvotes: 1