I have a situation, I have created two different nibs, one in Portrait Mode and other in Landscape mode. I had lots of designs in the view so, i had to opt for two different nibs. Now, I want to toggle the nibs as the interface rotates in the
common viewController
so that I can retain the filled values and the state of the controls I have in the view.
Right now I am using
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Override to allow orientations other than the default portrait orientation.
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight ){
[self initWithNibName:@"LandscapeNib" bundle:nil];
}else if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
[self initWithNibName:@"PortraitNib" bundle:nil];
}
return YES;
}
but it doesn't changes the Nib, it shows the initial loaded nib. May I guess it is loading but not showing because initial nib is already showing, is not removed. I am not able to find the solution of working with multiple nibs with a common view controller so that I can easily handle the functionality of the controls ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…