I'm developing a universal app. When my device is ipad I have 2 designs: Portrait and landscape.
I use this method: -(void)orientationDidChanged:(NSNotification *)notification
It works perfectly when I rotated my device. But I have a problem, when first load the view and I have not rotated the device. For that reason, I put this code in the viewdidload:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){ //
something.
}
else if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
NSLog(@"IPAD ** ");
if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)){
NSLog(@" vertical ** ");
}
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)){
NSLog(@"Horizontal ** ");
}
}
My problems is this: sometimes it works , sometimes not :(. This method: orientationDidChanged, when start to work? only if I rotate my device or immediately with the viewDidLoad , is necessary ask one more time the orientation when I have that method? Thanks for some advice.
I don't have problem when I rotated my device, it works perfectly :D .. My problem is when I recently run the application and I haven't turned the device