I had on my application 2 different views (one for Portrait and another for Landscape mode) and I would like to separate them into different XIB files so that I'm using less memory. I've done so but when changing my iPad's orientation my view becomes blank. I've tried to do the following:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
self = [[MyController alloc] initWithNibName:@"MyControllerLandscape" bundle:nil];
}
But it just initializes the view with no data (no images, no labels, ...). How can I "unload" the current view and "load" the new one with the interface orientation avoiding to pop the view and pushing a new one?
EDIT:
I've tried now this and it's more or less working:
[[NSBundle mainBundle] loadNibNamed:@"myPortraitView" owner:self options:nil];
[[NSBundle mainBundle] loadNibNamed:@"myLandscapeView" owner:self options:nil];
My question now is: if I do that on my init method, will it load both views into memory or just a reference to load the view when neded?