When using a UITableViewController, the initWithStyle: method automatically creates the underlying UITableView with - according to the documentation - \"the correct dimensio
I had the same problem and I solved it with:
-(void) loadView {
[self setView:[[[UIView alloc] initWithFrame:CGRectZero] autorelease]];
[[self view] setAutoresizesSubviews:NO];
/* Create & configure table and other views... */
[self setResultsTable:[[RadarTableViewController alloc] initWithNibName:nil bundle:nil]];
[[resultsTable view] setFrame:CGRectMake(0,45,320,200)];
}
This is done in the parent (just a plain UIViewController in my case) controller.
Set the frame in UINavigationController
.
You can set the top margin by using :
UIEdgeInsets inset = UIEdgeInsetsMake(50, 0, 0, 0);
self.tableView.contentInset = inset;
it's Not a good practice , just in case you want more space on top you can use it .
Should not use UITableViewController , Just simply Use UIViewController and Programmatically Create UITableview
I agree with Ben's answer. I've often run into the situation where I need to resize a UITableVIew due to other controls on a view.
I usually just have a regular UIViewController with a UITableView IBOutlet. Then, if I need to, I can just manipulate the UITableView object's frame to get it to the size I need.
If you are using Interface Builder, you can simply go to "Table View Size" properties window, and change Bottom Insets for both Content and Scroller with the height of another widget.