I am trying to lay out some subviews in viewDidLoad by taking into account the orientation,
Here’s my code. The NSLog is never executed. Please help.
-(void) viewDidLoad {
[super viewDidLoad];
if ( UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
}
if ( UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
NSLog(@"This is landscape");
}
}
I think that’s because a view is always loaded in portrait.
EDIT: Try: