objective c - How to make iPhone and iPad version of an app? -
i trying make app works on both iphone , ipad. looking how make interface compatible on both. when app loads displaying table view. how can load different nibs based on device? using switch between nibs.
if ([[uidevice currentdevice] respondstoselector:@selector(userinterfaceidiom)]) { if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiompad) { device = @"ipad"; } else { device = @"iphone"; } }
but in mainwindow.xib says view loaded view controller iphone. can make dynamic based on device? ie want show start of app different nibs based on device. thanks.
actually, apple automatically, name nib files:
myviewcontroller~iphone.xib // iphone myviewcontroller~ipad.xib // ipad
and load view controller smallest amount of code:
[[myviewcontroller alloc] initwithnibname:nil bundle:nil]; // apple take care of
Comments
Post a Comment