IPADのすべての向きをサポートしたいユニバーサルアプリを開発しましたが、iPhoneの場合はUIInterfaceOrientationPortraitとUIInterfaceOrientationPortraitUpsideDownだけが必要です
-(BOOL)shouldAutorotate {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return NO;
}else{
return YES;
}
}
- (NSUInteger)supportedInterfaceOrientations{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return UIInterfaceOrientationMaskPortrait;
}else{
return UIInterfaceOrientationMaskAll;
}
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone){
return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ;
}else{
return YES;
}
}
それでも横向きでの向きが止まらない