ios判断设备是iphone还是ipad

  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions  

  2. {  

  3.    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];  

  4. // Override point for customization after application launch.

  5. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {  

  6.        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone"bundle:nil] autorelease];  

  7.    } else {  

  8.        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad"bundle:nil] autorelease];  

  9.    }  

  10.    self.window.rootViewController = self.viewController;  

  11.    [self.window makeKeyAndVisible];  

  12. return YES;  

  13. }  


你可能感兴趣的:(ios判断设备是iphone还是ipad)