ios - load different xib for iphone5 not working in device -


possible duplicate:

how make xib compatible both iphone 5 , iphone 4 devices
can use 2 xibs 1 viewcontroller - re: porting iphone 5

i have developed iphone app i'm trying update giving ipad , iphone5 support. there lots of posts talking how handle none of them working me. 3.5'' iphones , ipads load xib need 4'' iphone doesn't (although in simulator works fine), here how handle it:

first of create 3 different xib files each viewcontroller (viewcontroller.xib, viewcontroller~ipad.xib , viewcontroller-568.xib). in 4'' xib 1 set size of view "retina 4 full screen".

then have used this load appropiate xib. may relevant in appdelegate set didfinishlaunchingwithoptions this:

appdelegate.m

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {      self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]];      nsstring *nibname = [uiviewcontroller nibnamedfordevice:@"viewcontroller"];      self.viewcontroller = [[bpviewcontroller alloc] initwithnibname:nibname bundle:nil];      uinavigationcontroller *navcont = [[uinavigationcontroller alloc]                   initwithrootviewcontroller:self.viewcontroller];      self.window.rootviewcontroller = navcont;      [self.window makekeyandvisible];      self.viewcontroller.navigationcontroller.navigationbar.barstyle = uibarstyleblack;      return yes; } 

as said works charm in simulator in real device ipad's , 3.5'' xib load properly. iphone5 still showing , down black bar...

you appear using wrong suffix on nibs/assets, use -568h@2x instead of -568h.

alternatively switch various ios assets / positions in code using:

if([ [ uiscreen mainscreen ] bounds ].size.height == 568 ) {     //iphone 5.0 specific code } else {     //none iphone 5 code } 

its worth noting @ stage using more nib files result in bigger .ipa. worth reading on how autolayout works , going approach keep executable size down.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -