Reputation: 2560
I am trying to resize a simple UITableView that fits between a navigationbar and a tabbar.
- (void)loadView
{
[super loadView];
UITableView *tableview = [[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 367.0f) style:UITableViewStylePlain];
tableview.dataSource = self;
tableview.delegate = self;
self.tableView = tableview;
[tableview release];
[self.view addSubview:self.tableView];
}
I have removed the autoresizing I have been trying to do because it does not work, any help is MUCH appreciated!
Upvotes: 1
Views: 2619
Reputation: 1294
1) Create your view programmatically in loadView, do not call [super loadView]
2) create tableView with size same as application screen, use [[UIScreen mainScreen] applicationFrame] or something similar
3) set UIViewAutoresizingFlexibleHeight for tableView
..Edited answer to be more clear..
Upvotes: 1
Reputation: 4428
tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth
tableView.frame = self.view.bounds;
[self.view addSubview:tableView];
Upvotes: 1