I have a UITableViewController subclass that I created to display a table of players. I want to resize it when you rotate (since I create it programmatically), I was going to map it's coordinates, such as self.view.frame = CGRectMake(x, y, width, height) but that doesn't seem to be working. When I print out self.view.frame it prints out (null).
My initialize code for the controller looks like so:
Code:
- (id)initWithStyle:(UITableViewStyle)style {
self = [super initWithStyle:style];
if (self)
{
dataSource = [[NSMutableArray alloc]init];
tableData = [[NSMutableArray alloc]init];
//Other unrelated stuff here
[tableData addObjectsFromArray:dataSource];
self.view.frame = CGRectMake(0, 44, 480, 368);
topBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 480, 44)];
topBar.tintColor = [UIColor blackColor];
[topBar setItems:[NSArray arrayWithObject:[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
target:self action:@selector(editTable:)]]];
}
return self;
}

The code that I have in the willRotateToInterfaceOrientation looks like so
Code:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
self.view.frame = CGRectMake(0, 44, 480, 226);
}
else
{
self.view.frame = CGRectMake(0, 44, 480, 336);
}
NSLog(@"%@", self.view.frame);
//This prints out (null)
}
Does anyone know why the frame would be null, and not properly resizing? I get a really small tableView (the tableView that looks like it is on top in the picture) over my other tableView that is below the subview, on another ViewController? It's clearly not 226 in height, which makes sense if the frame it's trying to manipulate is null, but I can't figure out why it would be.
Thanks a lot,
Joe