I am trying to create an application in which each view controller (.h / .m) has 2 NIB files ... one for portrait, one for landscape. Is this the "standard" way of supporting orientation, or should I manually adjust the orientation view programmatically? The problem I am facing is that when the user flips the orientation, all views are reset (so the user must re-enter the input of text fields / views).
Here is my orientation method:
- (void) changeTheViewToPortrait:(BOOL)portrait andDuration:(NSTimeInterval)duration{ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:duration]; if(portrait) { [[NSBundle mainBundle] loadNibNamed:@"myview-portrait" owner:self options:nil]; [self setupLayout]; } else{ [[NSBundle mainBundle] loadNibNamed:@"myview-landscape" owner:self options:nil]; [self setupLayout]; } [UIView commitAnimations];
}
ios iphone ipad nib orientation
Exegesis
source share