ios判断设备是iphone还是ipad

时间:2021-03-30 12:14:47
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        self.viewController = [[NQViewController alloc] initWithNibName:@"NQViewController_iPhone" bundle:nil];
    } else {
        self.viewController = [[NQViewController alloc] initWithNibName:@"NQViewController_iPad" bundle:nil];
    }
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}