I have a UIViewController that contains a subview and a UIToolbar. I'm trying to add another UIViewController containing an MKMapView as a subview, but it is not resizing properly and as a result, the map is overlapping the toolbar. What am I doing wrong?
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
[DebugLogger writeLog:@"Initializing RootViewController"];
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
self.title = @"Root View";
switchableView.autoresizesSubviews = YES;
switchableView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
switchableView.userInteractionEnabled = YES;
}
return self;
}
- (void)viewDidLoad {
[DebugLogger writeLog:@"Calling viewDidLoad in RootViewController"];
[super viewDidLoad];
self.mapView = [[[MapViewController alloc] initWithNibName:@"MapView" bundle:nil] autorelease];
[self.mapView.view setFrame:switchableView.frame];
[switchableView addSubview:self.mapView.view];
}