I am having an issue in my application which drives me mad. In my application, I rotate the simulator to the landscape mode, but in my below function, I get portrait orientation.
What is the problem here? Please help me out.
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ( interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown )
{
NSLog(@" portrait orientation");
}
else
{
NSLog(@"Landscape");
}
return YES;
}
Why you did't return a BOOL value? YES or NO to tell the OS that you're gonna handle corresponding orientation events.
The method returns BOOL, you have to return either YES or NO
First set the orientation value is the method
}
Now set the values of the coordinates which you require according to the boolean values in the setTheOrientation method.
If you want portrait mode then add return TRUE in if clouse and If you want landscape then add return TRUE in else clouse and if you want both mode then just type return TRUE in shouldAutoRotate clouse