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

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

Related

Removing launch screen file from Info.plist scales the views

I noticed something that when you remove the launch screen file entry from the XCode Info.plist file, any view of any view controller becomes scaled according to the screen size, so the views appear zoomed in on large screen sizes such as the iPad Pro (12.9 inches) and appear somehow zoomed out on smaller devices (iPad Pro 9.7 inches).
In that case it seems that the Auto Layout constraints have no effect as the scaling is done automatically.
I really can't understand what does this has to do with the layout constraints, so I appreciate if any one can explain what's the reason for that.
Without being able to provide deep details, iOS uses the launch screen definition (view or static images) to determine which size classes the app should use. If you have not supplied those, it seems you get scaling that you generally do not want.
That doesn't mean auto-layout no longer has any affect... it just means that the auto-layout engine is not using the current screen size for its size/positioning calculations.
You'll see very similar results if you explicitly set your project for iPhone only.
Simple, obvious solution: Don't remove the launch screen.
Yes this is expected behaviour... Same is for iPhone 6 Plus. If you remove the iPhone 6 Plus launch screen, it will display the iPhone 6 scaled version.
This is just for backward compatibility. If your app is not ready for iPad Pro or iPhone 6+, scaled version can be used by removing the respective splashing screens.
All current iPhone apps or iPad apps in AppStore those are not optimised runs as a scaled version.

Disable native resolution ONLY for iPhone 6 Plus

I need my app to not use iPhone 6 Plus' native resolution and rather scale up from iPhone 5/6.
I have removed the Launch Screen File and cleared "Retina HD 5.5" from the Launch Image, yet when people run it on iPhone 6 Plus, the app is still using its native resolution.
Note that removing the "Retina HD 5.5" was sufficient to bypass iTunesConnect App Screenshots validation for iPhone 6 Plus, yet the app itself is not honoring that.
Is there anything else to remove to eliminate iPhone 6 Plus native resolution?
There is not. You can only support 6 and 6 Plus together or none of them. As soon as you use the Launch Screen File Xcode assumes you want to support them.
I really don't know why you want to do that, but there are some tricks to resize fields and buttons (I assume you want to do that)
You should be able to determine the screen size/native screen size so you can resize your CGRects for example.
https://stackoverflow.com/a/4779415/2826164
create an global function or variable to multiply your current width and heigth by, for example native width of 6+ = 1242*0,60306 = 750 native.
i'm not sure if you need 1080 or 1242 because of downscaling
More info about iphone 6+ resolution

how to get a normal keypad on iphone 6 and 6 plus

I'm building an app that works fine on iphone 5. When I look at it on a iphone 6 or 6 plus however, I see that the keypad is stretched, basically zoomed in. I'm using autolayout and storyboards.
What do I need to set in order to make the keyboard scale to a normal size?
You need to ensure that the app is optimized to run in the native resolution of these devices, rather than the zoomed compatibility mode. This can be done by setting a properly-sized launch image for the iPhone 6/6+.
These launch images will be labeled Retina HD 4.7 and Retina HD 5.5 in your launch images file, respectively. If you do not see these options available in your launch image assets, create a new launch image set and they should be there.

Autolayout not working on iOS7 and Xcode 6

I've started using Xcode auto layout for my projects.
Auto-layout works perfectly when I'm testing on ios8 devices, it the view scales as needed.
However, things get a little crazy with ios7.
When I test my app on an ios7 iPhone 5 simulator, the app doesn't scale-up to the larger screen,
but only shows the 3.5 inch view, leaving black bars on the top and bottom of the screen.
I am using a tableView controller.
How do I scale the tableViewController up so that it fits on a larger screen in ios7?
(Like I've said, my app fits perfectly in ios8, on all screen sizes, but not in ios7.
Also, it scales fine on an ios7 ipad.)
thanks.
The Xcode (6) IDE should give a warning about this, that may not be so clear:
"Applications using Launch Screen Files and targetting iOS 7.1 and earlier
need to also include a Launch Image in an Asset Catalog."
This means you need to have the proper Launch-Images for the "Retina 4" screen,
which is 640 × 1136 pixels, and it should be configured in the assets-catalog,
just like your Application-Icons ("AppIcon"), but under "LaunchImage" there.
Once you add this 4-inch-compatible Launch-Image to your application,
iOS-7 will assume you are properly supporting the "Retina 4" screen,
and will launch the application in 4-inch mode.

How to make view size adaptive for ip 3.5, 4,4 retina

I am struggling with IB to make my views and controllers adaptive for all phone types. What I am experiencing is that 3.5 size works fine but when I run on the 4 simulator and 4 device there'll be black bars above and below the views.
How can I make the view adaptive to the device size? Code or IB option? I played with the Size:Freeform / 3.5 Full screen and 4 Retina full screen option but neither makes a difference. All subviews of my UINavigaionViewController have Size:inferred enabled.
Thanks,
EL
The trick is to tell the OS that you are iPhone 5 ready.
You do that by adding a Default-568h#2x.png default screen.
That's all there is to it.
See an exhaustive list of steps here.

Resources