判断为iPhone 还是iPad?

来源:互联网 发布:李世民 知乎 胡人 编辑:程序博客网 时间:2024/04/27 21:10

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

{

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

    // Override point for customization after application launch.

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

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

    } else {

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

    }

    self.window.rootViewController = self.viewController;

    [self.window makeKeyAndVisible];

    return YES;

}

0 0
原创粉丝点击