How to create the UI for different devices in iOS? [duplicate] - ios

This question already has an answer here:
Xcode5 ( 3.5" screen to 4 inch )
(1 answer)
Closed 8 years ago.
I'm working with an iOS application in which i uses the different controllers with 4 inch screen sizes.
I'm done with my application. Now it is the requirement that it also runs on the 3.5 inch screen like on iPhone 4S. I am using the auto layout. How can i do it?
This is my first application.So I have a little knowledge about UI.
My requirement is that when I run the same application on iPhone 4S with 3.5 inch screen size, it needs to be reset automatically with 3.5 inch.
Please help me out.

Use the iOS Simulator, that will give you an idea of how the application will turn out (Whilst you're in in choose Hardware -> Device -> iPhone Retina (3.5 inch).
You can adjust elements in interface builder to scale to different elements on the screen under the view tab. Try using the view tab (looks like a ruler) and specify the origin and scaling there.

Related

iOS auto layout support for all iphones?

I'm using autolayout storyboards for my ios app which is only for iPhone. When I submit, Apple reject it saying that the app should support iPhone 3.5 inch for ipad view on iphone resolution but making the UI for iPhone 3.5 inch is bit hard.
If I change it to support iPhone 3.5 inch onwards it gives bad view for iphone 5 inch. The contents are not centric there's long space for iphone 5 inch. What are the solutions?
Can I configure the settings to support iPhone 4 onwards?
or else Can I make two storyboards for iPhone 3.5 inch & 5 inches?
Yes, you can make 2 storyboards and switch them, depending on screen height, but why you can't adjust constraints for all iPhones screens? Usually this is possible.
One way for complex layouts - create constraint outlets and change them in code.
Another way - divide design to smaller UIViews, that contains elements, like container and set constraints between them.

How can I tell if a Springs and Struts app is scaling in the iPhone 6 simulator?

I have a couple applications built pre-auto-layout (but w/ Springs and Struts to support iPhone 5+) that I'm trying out in the iPhone 6 and 6 Plus simulator and they actually look quite good. However, I can't tell if the Springs and Struts are actually doing their job so-to-speak or if they're just being scaled. There must be some obvious thing I'm missing where it says which? Also, do auto-layout apps just automatically convert when recompiled with the latest SDK for iPhone 6 so they're not just scaling as long as 3X artwork is provided (in the case of 6 Plus)?
You can easily see, if your app runs in scaled mode by outputting the bounds and the native bounds screen of the main screen:
println("bounds = \(UIScreen.mainScreen().bounds)")
println("nativeBounds = \(UIScreen.mainScreen().nativeBounds)")
Without a designated launch images the output of the iPhone 6 Plus Simulator is:
bounds = (0.0,0.0,320.0,480.0)
nativeBounds = (0.0,0.0,960.0,1440.0)
The native bounds are 3 times the scaled bounds. This is the reason behind the #3x display.scale.
In case of the iPhone 6 Plus nativeScale also helps:
println("main screen native scale = \(UIScreen.mainScreen().nativeScale)")
println("main screen scale = \(UIScreen.mainScreen().scale)")
nativeScale will always be 3.0. scale will be 2.0 if the simulator does scaling.
To get a comprehensive understanding of the new resolutions see this great blog entry: http://www.paintcodeapp.com/news/iphone-6-screens-demystified
Use a different launch image for iPhone 6, iPhone 6 Plus and all the rest.
If you see a specific lunch image you know your app is not scaled and that it is running in the device's native resolution.
The only way I was able to tell was to go home and see if the status bar text was smaller than it was in my app. A smaller home screen status bar implies it is being scaled. If the status bar text is the same size within your app in the iPhone 6 sim as it is on the home screen of the simulator, then it is using your springs/struts or autolayout instead of scaling

app can't distinguish screen size [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to deal with iPhone 5 screen size?
How can I add support for 4-inch iPhone 5 displays to an iOS app in Xcode?
Is this even possible with the latest public Xcode release, v4.4.1?
Add a new launch image named Default-568h#2x.png to your project and it will work!
If your application is iOS6 only, the easiest way to make views that layout correctly in both 3.5-inch and 4-inch iPhone 5 designs is to use AutoLayout in your XIBs to make them adapt their size automatically (See the WWDC'2012 video sessions about that). If your application must support versions prior to iOS6, then you can still use AutoResizingMasks on your views to make them resize themselves to adapt to both 3.5 and 4 inch screens.
Then for your application to support the 4-inch display and take the whole screen when launched on an iPhone 5, simply add a "Default-568h#2x.png" launch image to your project.
The simple presence of this launch image will make your application launch full-screen on iPhone 5 instead of having black bands at the top and bottom.
Short answer : use the new launch image slot ( the Retina 4-inch ) one in XCode->Targets->Summary->iPhone/iPod Deployment Info
I have an OpenGL ES 2 app that despite all options I checked, nothing worked. Creating a new GLGame project adds black launch images for Retina 3.5 inch and Retina 4 inch. Despite every other comparison to project settings or .plist file I found nothing else to say "make it available for iPhone 5". I sure hope this changes in the future.

iOS make universal app for iPhone 4 and 5

Quick question. For iOS in Xcode I want to make an app that looks good on the iPhone 5 and the iPhone 4. I am using story boards. All I know is when you click the button on the bottom of the storyboard page with the two arrows on both sides of an iPhone it changes the views of the app from 4 inch to 3.5 or vise versa. This usually makes it look messed up because if I made the app with an iPhone 5 screen it looks weird on the iPhone 4 screen. Preferably without using code and just using storyboards, how do I make an app that is universal for the iPhone 4 and the iPhone 5. Basically like making an app universal for the iPhone and iPad where there are 2 storyboards (one for the iPhone and one for the iPad) how do I do that for the iPhone 4 and iPhone 5 (one story board for the 4 inch screen and one for the 3.5 inch screen)?
Thank you
Use autolayouts to format your views.
Those arrows are only to simulate the view. They are not view holders.
Check: https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/Introduction/Introduction.html

Modifying an existing 4-inch storyboard to work on a 3.5-inch screen [duplicate]

This question already has answers here:
Supporting Multiple Screen Sizes in Storyboards (3.5 and 4 inch screens)
(2 answers)
Closed 9 years ago.
I am programming an application (my first) for iOS 7 using Xcode 5.0.2, and I think I may have made a mistake in designing the story boards on the 4-inch display first, because I want my application to work on both the 3.5 and 4-inch display.
Do I have to create a new story board for the 3.5 inch, or can I use auto layout to configure what I already have? If I can, how do I configure it? I've used auto layout before, but not to support different screen sizes, only for changing from portrait to landscape.
If I have to create a new storyboard, do I have to create new classes for those or can I somehow link to the code I've written?
Autolayout is designed for just this sort of thing. If you have set it up for changing between portrait and landscape, it should Just Work when changing between 3.5 and 4 inches. If not, please post a more specific question!
If you are using storyboard, as #hatfinch mentioned it will work out of the box. You might have to go modify your constraints to make sure it look okay on 3.5 inch screen.
You can see how your views will look like in 3.5 inch by following ::
Select your storyboard.
From Editor menu, select " Apply Retina 3.5-inch Form Factor".

Resources