How to Full screen Specify Images
for 4-inch
iOS devices
. The 568@2x
will only work for Default image
Any Approaches will be use full. Please share some code snippet.
Asked
Active
Viewed 77 times
0

user2833647
- 83
- 4
-
Normal images like which you are using for the iphone4s app .It is compatable for it. – Romance Oct 01 '13 at 06:34
2 Answers
2
In that Case, You need can write one category method for UIImage and use that in all places where you need full screen images and also mention one
My Naming Convension:
Normal image: img.png
Retina image: img@2x.png
4inch Screen: img-4@2x.png
HEIGHT is Screen Height
Code:
UIImageView *bgImg = [UIImageView alloc] initWithImage:[UIImage imageNamed5:@"img.png"];
Category implementation:
+(UIImage *) imageNamed5:(NSString *) imgName
{
NSArray *paths =[imgName componentsSeparatedByString:@"."];
UIImage *img =nil;
if(paths.count == 2){
NSString *imgNme =[paths objectAtIndex:0];
NSString *ext = [paths objectAtIndex:1];
NSString *imgPath;
if(HEIGHT == 568)
{
imgPath = [NSString stringWithFormat:@"%@%@%@",imgNme,@"-4@2x.",ext];
}
else
{
imgPath = imgName;
}
img = [UIImage imageNamed:imgPath];
}
if(img == nil){
img = [UIImage imageNamed:imgName];
}
return img;
}

muthukumar
- 651
- 1
- 6
- 19
0
I use this way
Appdelegate *delegate = [[UIApplication sharedApplication]delegate];
//check the height of window
if (delegate.window.frame.size.height == 568)
{
//use image_568@2x
}else{
//use normal image
}

SreeHarsha
- 496
- 4
- 19