Is there a special method to get iPhones orientation? I don\'t need it in degrees or radians, I want it to return an UIInterfaceOrientation object. I just need it for an if-else
Here is a snippet of code I hade to write because I was getting wierd issues coming back into my root view when the orientation was changed .... I you see just call out the method that should have been called but did seem to be .... this works great no errors
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeLeft){
//do something or rather
[self
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft];
NSLog(@"landscape left");
}
if ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationLandscapeRight){
//do something or rather
[self
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
NSLog(@"landscape right");
}
if ([[UIDevice currentDevice]orientation] == UIInterfaceOrientationPortrait){
//do something or rather
[self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
NSLog(@"portrait");
}
}