Image Naming Convention for iPhone 5 - iphone

what is the Image Naming Convention for iPhone 5 like #2x for retina screens.

It is just the same. The #2x just means it's a retina image.
The only difference is the 568#2x (or whatever it is) for the splash screen but Xcode renames that file for you anyway.
Just keep using #2x.png

till now they have not released any official documentation for the iPhone5 Images.
You can do like this.
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [[UIScreen mainScreen] bounds].size.height * [UIScreen mainScreen].scale >= 1136)
{
//Write the code here for iPhone5 Image.
}
else
{
//this is for unto 4th gen iPhone
}

There is no specific naming convention for images on iPhone 5.
The Default-568h#2x will be shown on launch of an iPhone 5 or iPod Touch 5G. This will also enable the non-letterbox mode of your app. For your other f.e. background images you have to design flexible if you want to cover both screen resolutions. When you building an iPhone 4s App assure that f.e. a background image can be strechted up to the iPhone 5 size.

it is just the same. The #2x just means it's a retina image.
The only difference is the 568#2x (or whatever it is) for the splash
screen but Xcode renames that file for you anyway.
Just keep using #2x.png
I must add, that if you look at the simulator the pictures maybe stretched! You could fix this by checking the box (if u use storyboard) "auto layout" I have some problems too maybe this is a bug which will be fixed I hope...
and on storyboard or .xib u can change the size of the controller like here:

Related

Universal app with .#2x only

My universal app has two storyBoards. One for iPhone and one for iPad. A lot of the code has been coded programatically and both storyBoards share the same ViewControllers. An example of how this works in view controller as follows:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ iPadInUse = YES;}
else { iPadInUse = NO;}
So, if I have a image that needs to be displayed on both devices - I write the following:
if (iPadInUse == YES) { recordViewImage = #"iPadRecordPanel#2x.png"
// x and y positions to adjusted accordingly }
else { recordViewImage = #"recordingPanel#2x.png"
// // x and y positions to adjusted accordingly}
On the simulators everything works fine for all devices (retina /non retina). The only actual device I have is an iPhone 4S (all works fine). Is this ok what I'm doing as do not actually have any non retina images loaded fro non retina devices (all images suffix with #2x.png ??
Will my app get rejected because of this ??
No, this is not ok.
On devices that do not have retinta screen more memory will be used to load the retina images.
You should always provide non retina and retina images and never load #2x images directly. iOS will load the correct image for you.
Your app will not get rejected, and everything will work fine.
But there are two issues:
On non-retina devices, App will load larger images. Which is not required there..so memory utilization will increase there without any outcome.
You don't need to write conditional code for iphone and ipad for setting images.
You can use a tilde while naming the image files:
iPhone:
image#2x~iphone.png (retina only)
image#2x.png (retina only)
image~iphone.png
image.png
iPad:
image#2x~ipad.png (retina only)
image#2x.png (retina only)
image~ipad.png
image.png
It will not display proper image when you will give it name like iPadRecordPanel#2x.png. You can give name iPadRecordPanel.png and it will take 2x image of it from bundle. You can not give suffix with #2x. it will automatically identify proper image and display it.
No your app will not be rejected but you should not do this because not providing non-retina images may decrease performance and image quality on older devices due to the required down-scale operations.
Hope it helps you.

How to simply switch from iphone 4 size to iphone 5 size?

I would like to know how could I make my application enable for iphone 5 standards (especially screen-size).
I currently have an application designed for iPhone 4 so all the views are 460 px height.
Can I do some simple and automamic update to make it for iPhone 5? Without ruining the iPhone 4 style, I would like this app to be avaible on both.
There is not magic code that will make app adjust it self, just the Default-568h#2x.png top tell iOS that you app support the new 4" height.
The most important part is how you have set the Autoresize mask of you views. If then are set to grow (UIViewAutoresizingFlexibleHeight) then they will grow to fill the screen.
Check every view that the alginment of button have the correct Autoresize mask, for example if a button is ment to be at the button of the screen make sure that the Autoresize mask is set to the fix it self to the bottom and nog the default top.
First, see what your app looks like on iPhone 5. This can be done by including a Default-568h#2x.png within your project. This is the launch image for iPhone 5, and indicates to the OS that you support the taller screen size.
If you've programmmed your application well (for example, with decent Autoresize masks), the OS should take care of most of it for you, and it'll look decent already. If you want to use AutoLayout in iOS 6, this will also help for the iPhone 5.
If it does not look that great, then you can do some conditional modifications for iPhone 5 using the macro:
#define IsTallPhone() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)
So for example:
if (IsTallPhone()) {
frame = CGRectMake(0,0,200,500); // Use Tall Frame
}
else {
frame = CGRectMake(0,0,200,300); // Use Normal Frame
}
The conditional can be done for anything, for example to load a different .xib file. It entirely up to you.
Open your project in xcode 4.5 and just add a default image of iPhone5 resolution in launch images. all other screens will be stretched to fill the iPhone 5 screen. go to target summary and add retina 4 inch launch image.
But it really depends on the graphics they may appear stretched go for separate xib if required

Is there an image name convention for iPhone 5

I'm using an image that will fill the full view of an iPhone. For iPhone 3GS we name it image.png for iPhone 4 we name it image#2x.png -is there an image name convention for iPhone 5 where it will automatically substitute it, or do I need to manually check which device I'm on?
I've read elsewhere that we keep on using #2x but I don't want my image stretched.
There is no specific image name conventions for iPhone 5 except for the Default-568h#2x.png image.
Your images will not be stretched when you use #2x on the iPhone 5, it is just the layout that will change.
Since there is no specific naming convention for the 4" screen (5th gen iPod touch and iPhone 5), you need to check the screen height yourself and load a different image.
if ([UIScreen mainScreen].bounds.size.height == 568) {
// 4" screen - load appropriate image
} else {
// regular screen - load standard image
}
This will work in portrait orientation.

cocos2d iphone 5 4 inch display support

I have been looking everywhere for this but with no luck.
How do I prepare my cocos2d based game for bigger 4 inch display of the iPhone 5?
My app is working but i want to enhance it for the bigger 4 inch display.
Cocos2d uses its own suffixes for retina display images. For retina display of the iPhone 4 and 4S it is image-hd.png. Is there a suffix for iPhone 5? How do I accomplish this?
Cheers.
There is no extra file suffix for iPhone 5, after all it's only 176 pixels (88 points) wider. It's treated like a regular Retina phone, hence cocos2d will load the -hd files.
The rest is just about positioning your images depending on the device. The simplest way is to just treat the 44 points on either side as a "dead zone" where no user input can occur and where there's no guarantee the user can see game objects.
Update:
cocos2d 2.1 added the -widehd suffix. It was said that 2.1 final release will have the suffix renamed to -iphone5hd.
In light of future screen sizes I sould personally set and use a -568hd suffix because other phones beside iPhone 5 may have the same resolution. Naming the suffix after a specific iPhone model is a tad short-sighted to say the least.
Add it to AppDelegate:
[CCFileUtils setiPadRetinaDisplaySuffix:#"your suffix"];
[CCFileUtils setiPadSuffix:#"your suffix"];
[CCFileUtils setiPhoneFourInchDisplaySuffix:#"your suffix"];
[CCFileUtils setiPhoneRetinaDisplaySuffix:#"your suffix"];
Not sure why everyone is saying there isn't.
The suffix is -568h for iPhone5/iPod Touch 5th (so the 4 inch retina displays).
The total list:
-hd (iPhone 4/4S, iPod Touch 4th)
-568h (iPhone 5, iPod Touch 5th)
-ipad (iPad 1st/2nd)
-ipadhd (iPad 3rd/4th)
Add this to AppDelegate with your chosen suffix:
if((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) && ([[UIScreen mainScreen] bounds].size.height == 568)) {
[sharedFileUtils setiPhoneRetinaDisplaySuffix: #"-your suffix"];
}
It took me awhile to figure this out, since I'm new to cocos2d. So I thought a recap might be helpful for those like me. In cocos2d 2.1, all you have to do is creating graphics for the target screen sizes and follow cocos suffix naming convention. Note that cocos's suffix convention is not the same as iOS's.
In my case, I have a background image that occupies the full screen. So, I made...
background.png at 480x320 for iPhone
background-hd.png at 960x640 for iPhone retina (3.5")
background-iphone5hd.png for iPhone5 retina (4")
And use the following code to load the image into CCSprite. Cocos will figure out which image to use for you.
CCSprite *background = [CCSprite spriteWithFile:#"background.png"];
background.position = ccp(background.textureRect.size.width/2,
background.textureRect.size.height/2);
[self addChild:background];
For an element like a character that doesn't occupy the full screen, cocos2d will pickup character-hd.png automatically in iPhone5. There is no need to create character-iphone5hd.png version.
You can read more about this in version 2.1 release note at
https://github.com/cocos2d/cocos2d-iphone/wiki/cocos2d-v2.1-release-notes
This is how i did it for cocos2d v2.1-beta4.
In CCFileUtils.h i added:
- (void)setIphone5HDSuffix:(NSString *)suffix;
In CCFileUtils.m:
- (void)setIphone5HDSuffix:(NSString *)suffix
{
[_suffixesDict setObject:suffix forKey:kCCFileUtilsiPhone5HD];
}
In AppDelegate.m:
[sharedFileUtils setIphone5HDSuffix:#"your_suffix"];
And that's enough!
Did you follow the following post, adding the default image for it, named Default-568h#2x.png with a resolution of 1136x640?
How to develop or migrate apps for iPhone 5 screen resolution?
If it does not work, I found this post on cocos2d forum, containing a lot of infos:
iPhone 5 1136 x 640 screen resolution: http://www.cocos2d-iphone.org/forum/topic/39491
Now cocos2d support iPhone wide screen also.
-wide.png for iphone 5
-widehd.png for iPhone 5 HD
I was just playing around with suffixes in Cocos2D 2.1-rc1 and was able to get it to automatically load a iPhone5 file with the "-iphone5hd" suffix, not changing anything in AppDelegate in the sharedFileUtil section of code. Hope that helps, also.

retina display graphics on the iPad not showing up - why?

I've installed my iPhone app on an iPad. When I tap this "2x" button, the app gets scaled up, but it doesn't use my retina display graphics. Isn't that somewhat stupid? I am sure I did something wrong!
What must I set in the info.plist or elsewhere that the iPad will use my retina display graphics when the app is watched in 2x mode?
No, it literally just scales up the screen. It may be a bit lame but that's by design. Note that even the text is pixel-doubled.
If you want to make better use of the screen you have to make a "Universal" app.
If you use a hi-res image (not called #2x) in your app, then size the UIImageView half the size of the image it will appear crisp on the iPhone, retina, and iPad scaled up.
Please make sure your retina image naming convention is correct.
For retina image naming convention should be #2x.Suppose if your regular image name is like
icon.png then for retina it should be icon#2x.png.