我开发了一个通用应用程序,我想支持 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;
}
}
但仍然没有停止横向的定位