iphone - MainWindow-iPad.xib in xcode 4.6.3 -
now reading book head first iphone , ipad development 2nd edition(dan pilone, tracey pilone). , when, according exercise in book , need change program iphone universal in book xcode making mainwindow-ipad.xib automatically, xcode doesn't. beginning program in book has file mainwindow.xib, don't. should now? if change masterviewcontroller.xib (navigation template) changes in iphone simulator version.
rephrasing question per comment:
if smb want make universal program , xibs need different on ipad , on iphone, do?
you in appdelegate:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone) { self.viewcontroller = [[hwviewcontroller alloc] initwithnibname:@"hwviewcontroller_iphone" bundle:nil]; } else { self.viewcontroller = [[hwviewcontroller alloc] initwithnibname:@"hwviewcontroller_ipad" bundle:nil]; } self.window.rootviewcontroller = self.viewcontroller; [self.window makekeyandvisible]; return yes; } that code taken straight single view template in xcode - code valid or without template.
it assumes have 2 separate xib files, 1 called "hwviewcontroller_iphone.xib" , other called "hwviewcontroller_ipad.xib". names don't matter long agree initwithnibname: string in code (you leave out '.xib' in code).
you can make xib files in xcode new > file > user interface > view
Comments
Post a Comment