Monday, 15 April 2013

iphone - What are the correct sizes for a background image for an iOS app -



iphone - What are the correct sizes for a background image for an iOS app -

i know size should image want utilize background on ios app. application in portrait. thing image not simple image that

instead have image don't want catted navbar , tabbar. that:

my question is: right sizes image in order ok on iphone, iphone4 , iphone5 , how xcode know image must use? names must use. if utilize background.png background@2x.png iphone4 , iphone5 retina screens going utilize background@2x.png iphone5 has bigger height. can help me understand?

update

the solution: used iphone5 size 320x455 image name default-568h.png , 640x910 image name default-568h@2x.png. other iphone devices 320x367 image name default.png , 640x734 image default@2x.png. used code on viewdidload:

#define is_iphone5 ([[uiscreen mainscreen] bounds].size.height == 568) if (is_iphone5) { uiimageview *backgroundimage = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"default-568h.png"]]; [self.view addsubview:backgroundimage]; [self.view sendsubviewtoback:backgroundimage]; } else { uiimageview *backgroundimage = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"default.png"]]; [self.view addsubview:backgroundimage]; [self.view sendsubviewtoback:backgroundimage]; }

#define is_iphone5 ([[uiscreen mainscreen] bounds].size.height == 568) if (is_iphone5) { self.backgroundimageview.image = [uiimage imagenamed:@"default-568h.png"]; self.backgroundimageview.frame = cgrectmake(0, 0, 320, 568); } else { self.backgroundimageview.image = [uiimage imagenamed:@"default.png"]; self.backgroundimageview.frame = cgrectmake(0, 0, 320, 480); }

ios iphone xcode image

No comments:

Post a Comment