簡體   English   中英

啟動應用程序Iphone縱向和Ipad橫向

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM