iOS Development: How can I prevent an iPad from running a universal app in iPad mode?

前端 未结 9 1334
死守一世寂寞
死守一世寂寞 2020-12-31 04:50

I\'m diving into iOS development and I created a universal app that turned into an iPhone-only app. When it runs on the iPad, it just loads a white screen since there\'s no

9条回答
  •  甜味超标
    2020-12-31 05:34

    Another way to do it (with code) is:

    In your App's AppDelegate (if your App was created as an Universal App) you can find the following code:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {   
        // Override point for customization after application launch.
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
            //iPad...
    
        } else {
            //iPhone and iPod Touch...
    
        }
    
        return YES;
    }
    

    There you can customize what view to show.

提交回复
热议问题