发布应用程序Iphone肖像和Ipad景观
我有这个代码,我需要检测的是ipad发布应用程序场景还是iphone仅处于纵向模式发布应用程序Iphone肖像和Ipad景观,iphone,ios,objective-c,ipad,Iphone,Ios,Objective C,Ipad,我有这个代码,我需要检测的是ipad发布应用程序场景还是iphone仅处于纵向模式 NSString *deviceType = [UIDevice currentDevice].model; if([deviceType isEqualToString:@"iPhone"]) { NSLog(@"This is iPhone"); } else { NSLog(@"This is iPad"); } 这
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType isEqualToString:@"iPhone"])
{
NSLog(@"This is iPhone");
}
else
{
NSLog(@"This is iPad");
}
这很有效!!!对于IOS 6
-(NSUInteger)supportedInterfaceOrientations{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
return UIInterfaceOrientationMaskPortrait;
else
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate {
return YES;
}
iPodtouch呢?您应该使用
if(UI\u USER\u INTERFACE\u IDIOM()==UIUserInterfaceIdiomPad)