简体   繁体   English

启动应用程序Iphone纵向和Ipad横向

[英]Launch app Iphone portrait, and Ipad landscape

I have this code, i need detect is ipad launch app landscape or iphone in portrait mode only 我有此代码,我需要检测的是ipad启动应用程序横向还是仅纵向模式下的iphone

    NSString *deviceType = [UIDevice currentDevice].model;

    if([deviceType isEqualToString:@"iPhone"])
    {
        NSLog(@"This is iPhone");
    }
    else
    {
        NSLog(@"This is iPad");
    }

This works!!! 这有效!!! for IOS 6 对于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.

相关问题 应用程序支持ipad和iphone中的应用程序横向和纵向模式 - App support the app Landscape and portrait mode in both ipad and iphone 3个媒体查询iphone肖像,风景和ipad肖像 - 3 media queries for iphone portrait, landscape and ipad portrait iPhone纵向专用应用程序在iPad上以横向显示 - iPhone portrait-only app starts as landscape on iPad 应用程序可以自动从iPad上的肖像旋转到风景,但不能在iPhone上 - App can auto rotate to landscape from portrait on iPad but not on iPhone iPad在横向模式下的iPhone App在启动时不响应任何触摸 - iPhone App on iPad in Landscape mode does not respond any touches at launch Ipad在横向模式下和iphone在纵向模式下 - Ipad in landscape mode and iphone in portrait mode iPhone锁定人像,iPad锁定风景 - iPhone locked Portrait, iPad locked Landscape 如何从iPhone中的肖像启动横向视图? - How to launch landscape view from portrait in iphone? iPhone应用程序在横向和纵向模式下都可以正常工作,但在iPad上只能在一种模式下工作? - Iphone app is working fine in both landscape and portrait mode but in ipad it only works in one mode? 如何设计仅在ipad的横向模式和iPhone的纵向模式下运行的iOS应用? - How to design an iOS app which runs only in landscape mode in ipad and portrait in iPhone?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM