ããå¨ioså¼åçè¿ç¨ä¸ï¼æå¯è½è¿éåºç¨å¨iphoneåipadä¸é½è¦ä½¿ç¨ï¼ä½æ¯æä¹å¤æå½å设å¤æ¯iphoneè¿æ¯ipadå¢ï¼å¨è¿éæä¾ä¸ç§æ¹æ³æ¥å¤æè¿ä¸ªè®¾å¤æ¯ä»ä¹è®¾å¤ï¼å
·ä½ä»£ç å¦ä¸
?
NSString *nibTitle = @"PadContent"; //é»è®¤æ¯ipad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{ //å¦æå½å设å¤æ¯iphone å°±æ¹ä¸ºiphoneçnibæ件
nibTitle = @"PhoneContent";
}
[[NSBundle mainBundle] loadNibNamed:nibTitle owner:self options:nil];//å è½½nib
- (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;
}
温馨提示:内容为网友见解,仅供参考