iphone - UIView for iphone5 and iphone4 -


i have created uiview, 2 xibs support iphone5 , iphone4. view width (iphone5 - 470) , (iphone5 - 400). have initialized view checking conditions iphone5 or iphone4. while running app, seems take iphone5.

categoryview *puzzleview = [[categoryview alloc] initwithframe:cgrectmake(0, starty, levelscrollview.frame.size.width, 190)]; bool isiphone = is_iphone5([[uiscreen mainscreen] bounds].size.height); if (isiphone) {     puzzleview = [[[nsbundle mainbundle] loadnibnamed: @"categoryview5"  owner:self options:nil] objectatindex:0]; } else  {     puzzleview = [[[nsbundle mainbundle] loadnibnamed: @"categoryview-iphone"  owner:self options:nil] objectatindex:0]; } 

the probles lies in line:

bool isiphone = is_iphone5([[uiscreen mainscreen] bounds].size.height); 

no checking wether size.height not 0

change :

bool isiphone = is_iphone5([[uiscreen mainscreen] bounds].size.height > 480.f); 

bout 1 should not this. make 1 view , let grow screen size better option. incase apple ever decide add other screen size not have change in code.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -