can the ui design for old iphone be used on iphone4? - iphone

I'm developing my software, all the ui is drawn based on 480x320 size screen, can my software run on iphone4 without any modification?

Yes it can run with no modification.
If you'd like to create "retina" assets you can create all of your images at the double resolution and include copies with '#2x' appended to the filename in your Application bundle. The iPhone will automatically load the correct images.
Example:
existing image - myImage.png
new up-sampled image - myImage#2x.png

Yes, but any images sized for the earlier iPhone models will look chunky compared to custom-designed iPhone 4 images.

Both the iPhone 4 and older devices are 320x480 points in size, which is the coordinate system that Core Graphics and UIKit uses. So your software will run the same.
Only the automatic scaling between your bitmaps and the display will be different. If you have bitmapped content or images, you can optionally provide #2x sized versions that will look somewhat smoother without the 2X scaling on iPhone 4 devices. This is nice, but optional.

Related

Images to Target Specific iPhone Models

Say I have an image which is half the height of an iPhone 4s screen display, when this image is loaded to an iPhone 5 clearly this size is no longer half the size of the iPhone, as the iPhone 5's height is slightly larger then the iPhone 4s.
My question is, like using the image 2x and 3x, is there a way of adding images to your app that target specific iPhones? So that the other images not targeted will not be downloaded with the app.
Or will I need to add images of various sizes to the app and then in the code, say if iphone4 load this image, if iphone5 load this? The only reason I don't want to do this is because I will have 3x the amount of stored images (target iPhone 4, 5, 6) than I would for the iphone6 plus or iPad.
What I was hoping for something like image#2x~iphone4.png or image#2x~iphone5.png, but this doesn't work.
David Cao's answer is correct for bundled image assets, but you have mentioned that you don't really want to include this many assets with the app.
You may want to look at the App Thinning features of Xcode 7 / iOS 9, along with On-demand Resources this will allow you to load your required images into Xcode but the App Store would only download the resources required for the device being used.
If you still need to support iOS 8 you would need to have the images stored on a remote server and load them in when needed.
Take a look at image assets, it solves the exact problem you've stated.
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html
What it does is allows you to provide 1x, 2x, and 3x images which can be referenced as a single name, when you call [UIImage imageNamed:#"imageNameHere"].

XCode iOS simulator - application is pixelated

I'm a beginner with XCode and I've encountered an issue. When I build my application, it looks fine in the standard iPhone simulator, but when I change the hardware to a retina device, the UI elements of my application become pixelated. How can I fix this?
You're seeing that because the retina screen is stretching the image you're supplying across more points on the screen. You can supply hi-res images in your bundle by appending #2x to the filename
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImage_Class/Reference/Reference.html: "If you load an image from a file whose name includes the #2x modifier, the scale is set to 2.0. You can also specify an explicit scale factor when initializing an image from a Core Graphics image. All other images are assumed to have a scale factor of 1.0. "
Here's a guide to supporting high-resolution screens.
As #RobotWoods mentioned, all images in your app need to have #2x versions.
If you're using OpenGL ES, custom code that creates images, or core animation, you need to make sure your code accounts for the display's scale.
If you're using only standard UIKit elements like UIButton, UILabel, UITableView, etc. then all you need to do is provide the #2x images.
If that doesn't help, please post screenshots and relevant code of what looks blurry.

Graphics on iPhone Application

I have a graphic designer who is doing some graphics for my iPhone app. Most recently she made me a background pattern and posed me two questions that I'm unsure of how to answer:
1) What should the size of the background pattern be?
-For this I know that when I'm programming my app,the screen is in terms of 320 by 480 (when in portrait mode), however is this the appropriate unit that I should give her (I'm only worried about iPhone 4 and below for now)? Like for instance, I know there is a retina display and I've seen the phone resolution of my phone also be listed as 640 x 960. I'm just confused of what the best thing to tell her regarding this is, she does not have any iPhone experience and will be using the traditional graphic programs like illustrator, photo shop etc to do the graphic design.
2) What file type should it be?
-I've read the iPhone supports mostly all of the most popular graphic file types, but is there anyone particular that would work best on an iPhone app?
The standard for iPhone resource images is PNG. If you want to target iPhone 4+ with retina display, have the designer provide two versions of the PNG: A standard version and a double-sized version which should have #2x appended after the filename, but before the extension.
So
image.png
for regular resolution and
image#2x.png
for retina resolution. iOS will automatically pick the best one to use based on the screen available.

Not including non-retina display images in an iPhone project

I have an iPhone Xcode project that currently only contains images for retina display (twice the size as normal and with a #2x.png suffix). When I run the app on the iPhone Simulator (non retina) the images are still being displayed. Does this mean I don't need to worry about including two sets of images: retina and non-retina?
This all seems a bit odd. I would assume that no images would appear on a non retina device if there are no non-#2x files included.
Note: I have not tested my app on a non retina device. Just the simulator.
I'm pretty sure that iOS will just use the #2x and scale it down if you don't have a non-retina graphic. Although that's sub-optimal since you're letting iOS do the scaling at runtime which will be slower than including the non-retina graphic and also iOS might not do as good a job as scaling as your graphics editor of choice.
Even if it works, it's not good practice, and if you have a media heavy app definitely it would impact performance and battery life and memory foot print and ....
By the way, is it just that you don't have the 1x graphics available to you or you are concerned about your apps (download size) or ...
If you are assigning the images in Interface Builder, and you set the image property on a UIImageView to image#2x.png, for example, iOS will not know that it's a high resolution "2x" image. In fact, on a retina display, iOS will look for an image named image#2x#2x.png. Since it won't find it, it will set the scale factor of the image to 1.0.
The contentMode property (just "mode" in XCode) will decide if any scaling of the image occurs to fit the constraints of the UIImageView. You may wish to set the mode to "Aspect Fit" to get the high resolution image to scale as needed for both retina and non-retina displays. In general, the image will display as seen in Interface Builder.
If you are using UIImage's imageNamed or similar function to load the image, and just specify image (where "image.png" doesn't exist, but "image#2x.png" does), then iOS will actually find the image on a non-retina display, though the scale factor will be 1.0. As previously, you'll need to scale it to fit your view. The image will work normally on a retina device, and the scale factor will be set to 2.0, since iOS looks for a "2x" image first, and it doesn't matter if the other file exists or not.
This is from Apple's documentation on imageNamed:
On a device running iOS 4 or later, the behavior is identical if the
device’s screen has a scale of 1.0. If the screen has a scale of 2.0,
this method first searches for an image file with the same filename
with an #2x suffix appended to it. For example, if the file’s name is
button, it first searches for button#2x. If it finds a 2x, it loads
that image and sets the scale property of the returned UIImage object
to 2.0. Otherwise, it loads the unmodified filename and sets the scale
property to 1.0. See iOS App Programming Guide for more information on
supporting images with different scale factors.
If at all possible, you really should include both retina and non-retina images. Using higher-resolution images than necessary negatively affects memory and performance.

What size images should I use in order to support the two iphone resolutions?

I have a few questions about screen resolution, that I'm not clear on. These questions assume they my app will be running on iOS 4.0 and up, and on either iPhone 3GS or iPhone 4.
Should the size of the splash image (default.png) be (960x640) or (480x320)?
Should the size of the app icon (Icon.png) be (57x57) or (114x114)?
What about other graphics that I may use in my app, such a graphic that represents a button? Should I always create these images for the higher resolution, and have the app scale them down? In other words, if I want a button image to be displayed on the 3GS that is 200x40 - should I create the image at 400x80, so that iPhone 4 can take advantage of it?
Thanks!
A good guide to this can be found here: http://mobile.tutsplus.com/tutorials/iphone/preparing-your-iphone-app-for-higher-resolutions/
In general you just create 2 sets of images. Your original and then a new one twice as big with #2x in the name. So for image.png at size 32x32 you would have one that is twice the resolution called image#2x.png at size 64x64. In your app just always use the image.png in Interface Builder and when loading in code.
There is no need to detect the device. These images will automatically be picked up by the OS and subbed in as necessary.
Provide both sizes (960x640 & 480x320) for the splash image using the #2x method described above
Provide both icons (57x57 & 114x114) using the #2x method
For our apps we use a combination of the #2x images and just Scaling the large images. (More information on this can be found in the above article) We use the #2x images for bar buttons, icons, etc. But for UIImageViews we often just use the Scaling. There can be a performance hit for doing this, but for most apps I'd say this is negligible. The savings in file size sometimes make scaling the only option.
Related Questions:
Retina/non-retina images in UIImageView
Making an app Retina Display friendly
You need to provide both if you want them to look nice. For example,
Default.png -> (480x320)
Amd
Default#2x.png -> (960x640)