[英]App support the app Landscape and portrait mode in both ipad and iphone
[英]Launch app Iphone portrait, and Ipad landscape
我有此代碼,我需要檢測的是ipad啟動應用程序橫向還是僅縱向模式下的iphone
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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.