Universal app with .#2x only - iphone

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.

Related

iOS7 App Submission - with only 2x (retina) images?

I'm currently developing an application for iPhone with iOS7, only.
From what I read, for iPhone with iOS7, there is no support for older devices than iPhone4.
If that's the case, when it comes to images, all I need is retina images (#2x).
Can I submit to the App Store, an app with only retina images, since the app's minimal requirement is retina devices ?
Thank you.
Possible duplicate of Can I dump my non-Retina Images for a iOS7 only app?
Anyway, as long as I know you don't need #2x version of your images as long as you don't support old displays, but remember that your images as to be double width and height, then if you have a 100x100px UIImageView, you need to load a 200x200px image to meet retina resolution.
EDIT: To explain in deep.
Actually, iPad 2 and iPad mini 1st generation run iOS 7 and doesn't have retina display. Anyway using #2x images it is not mandatary. You can just use double size images and set your UIImageViews' contentMode to UIViewContentModeScaleToFill to fit your needs.
PROS -> smaller bundle
CONS -> worst performaces

Image Naming Convention for iPhone 5

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:

Suffix for Retina Images in iPhone 5

I have some image files for iPhone 5 size 640x1136, i have previously implemented retina images for iPhone 4 & 4S using #2x suffix, so what will be the suffix for images in iPhone 5, we can user the same as is #2x or it has to be changed.
It’ll still use #2x images where they’re available. There’s a -568h suffix you can use for the launch image, as in Default-568h#2x.png, but that’s currently the only place it’s supported; see Leo’s answer for a way to get that working elsewhere.
See my answer here. Some useful macros to help you with dealing with images.
For the iPhone Retina 4-inch (iPhone 5) it's still the #2x suffix because the density is the same as the iPhone Retina (iPhone 4 and 4S). The screen is bigger but have the same density.
The -568h suffix will work only in for the default image because it's the only place you really need it (just to tell the system that your app have been optimized for this new screen size, and it can stretch your views).
The naming convention Default-xxx.png is just here to provide the right image while the app is launching but I think it's non sense to try to replicate the same to load other images in imageViews. It's like the Default-(landscape|portrait).png on iPad. You never need this convention to load images yourself.
The only rule is:
# is for density (2 density exist right now, normal and 2x)
~ is for device (2 different devices exist right now, iphone and ipad)
To adapt images/imageView on the 4-inch iPhone you should play with your imageView content mode and the autoresizing configurations.

Retina display compatibility

For our iPhone app, we are using 50 x 50 user image (from facebook). It works fine for iPhone 3G and 3GS but not for iPhone 4 due to its high resolution display. For iPhone 4 we tried to send 100 x 100 (variable height) image but it is not working for obvious reasons. Any thought?
You don't need to do anything different for the Retina Display. Using exactly the same image as you have on the older iPhone will work exactly the same.
If you have a higher resolution image that you'd like to display instead, then if you save the file with a #2x suffix then, if the device has a Retina display, it will pick that instead. In most cases it should not require any extra code.

Is there any difference between iPad 2x mode and iPhone4 Retina display (for developer)?

Graphics development for iPhone4 and old iPhones was changed in several ways:
The concept of point was introduced
to replace pixel.
Methods of UIImage will load high
resolution resource files with #2x
in the file name.
Scale factor was added to UIScreen,
UIView, UIImage, and CALayer
classes.
So if we handle CGImage carefully, it's not hard to support the high resolution Retina display of iPhone4.
I have several questions about non-native iPad app in iPad 2x mode:
Could all the changes from old
iPhone to iPhone4 (#2x resources
auto loading, point concept, scale
factor) be applied to iPad 2x mode.
The scale of app on iPad can be
changed. How can I handle it?
With The new iPad sporting Retina Display you will need another set of images for some items such launcher icon, launch images (splash screen).
For example:
The launcher icon for Retina Display on iPhone/iPod Touch is 114 x 114 but on The new iPad the same icon for Retina Display is 144 x 144.
Other example:
On an Universal App, for the launch images (splash screen) you'll need an image set for phones/music players:
Default.png (For old devices)
Default#2x.png (For phones/music player with retina display)
Another image set for Tablets:
Default-Portrait~ipad.png (For original iPad and iPad 2)
Default-Portrait#2x~ipad.png (For the new iPad with retina display)
Default-Landscape~ipad.png
Default-Landscape#2x~ipad.png
The "#2x~ipad" will work on the new iPad in the same way "#2x" worked for the phones and ipods, but will be relative to the old iPad image set.
Unfortunately, all of those content scale functions were added in 4.0, so I don't think there's any way to use the iOS4 stuff that you're asking for.
The iPad 2x mode is just a way to run iPhone-only apps on the iPad's larger screen. If you want to take advantage of iPad's larger screen, all you have to do is create a universal binary (i.e. one that contains views for both iPhone and iPad).
There is no way to get the iPad 2x mode to display your iPhone retina level content automatically—Apple do not support this... presumably as they want people to put effort into developing iPad-specific interfaces for their apps.