Reputation: 514
My app works only in Landscape. Thus I set the Initial Orientation and Supported Orientation at LandScape Home Right.
However, initial launch orientation always becomes Portrait. After navigating to next page and return, the orientation is correct.
This might be the similar question to the following, In IOS 6 on iPad, initial rotation is always portrait, after that it always rotates correctly
But the solution there is not working as the 'handleRotationFor' gives warning: instanceMethod -handleRotationFor is not found (return type defaults to 'id')
How should I fix this error?
Please help
Upvotes: 1
Views: 1721
Reputation: 28720
In Xcode in the files pane click on your project and then select target from right pane. Then in Summary tab see supported orientations. Only select Landscape right. Also you can implement
-(NSUInteger)supportedInterfaceOrientation {
return UIInterfaceOrientationMaskLandscapeRight;
}
in your app delegate
Upvotes: 1
Reputation: 557
Check the supported orientations in the info.plist of the app. Check and set orientations in the nib file as well.
You can check orientations by using [[UIDevice currentDevice] orientation]
Upvotes: 0
Reputation: 458
project Targets --> click on "Summary" tab and choose your Orientation in "Supported interfaces Orientations"
Upvotes: 1
Reputation: 27598
In Xcode under summary tab make sure portrait and upside down are not pressed down. Also Add these three functions.
// *********************
// ios6 orientation support
// *********************
- (BOOL)shouldAutorotate
{
UIInterfaceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
return NO;
}
else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
return NO;
}
else
{
return YES;
}
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
return NO;
}
else
{
return YES;
}
}
Upvotes: 0