Is it possible to define a custom image suffix for iPhone 6 Plus, while still using the same points sizes as on iPhone 5? - ios

We have an app that is made for iPhone 4/5 and iPad/iPad Retina. The interface XIB files for iPhone do not use dynamic layout, and the code that places UI elements assumes a screen width of 320 points and a screen height of 480 or 568 (iPhone 5) points.
Due to a lack of time, we currently can't adapt the app for iPhone 6 and iPhone 6 Plus the "right way" (by changing the XIB files to use dynamic layout, and changing the code to work with variable screen widths/heights, then testing all the UI positioning again). But we easily can generate higher-resolution versions of the images.
I've experimented with the following: I don't add a Launch Image for iPhone 6 / 6 Plus; as a result, the app simply runs upscaled on an iPhone 6 Plus, and the screen still has 320 x 568 points. Everything runs fine, but the graphics are very blurry.
However, if I load a higher-resolution image (e.g. 1242 x 2208 pixels for the background) and set an UI element to use this image, then the image is sharp. (I'm testing with the simulator; don't have an iPhone 6 Plus available; I hope the behaviour is the same on a device).
Instead of adding the above workaround for each image individually, what I want to do is: at the start of the app, check the model of the device, and in case of iPhone 6 Plus, tell the app to use a custom image suffix. This suffix should be used for all images, not only those that are loaded via code, but also the images that are specified in XIB files. Is this possible?

Don't complicate yourself. just like retina with suffix #2x, you have to add #3x for iPhone 6 Plus.

Related

Why is iPhone 8 screen size reported as 320x480?

I have inherited an app that uses separate Storyboards for iPhone and iPad. Neither uses autolayout. In viewDidLoad() I log the value of UIScreen.main.bounds.
For any iPhone (5s through X) the logged size is 320x480. This does not change after viewDidLayoutSubviews().
When I create an app from scratch, I get the expected sizes (e.g. 375x667 for iPhone 6 thru 8).
What could be different in my hand-me-down app that makes the screen size uniformly the ancient values for 1x iPhones?
Please note this has nothing to do with view resizing -- this is the screen we are talking about. Similarly the screen scale plays no apparent role.
When you create a new project, if it comes with a Storyboard for Launch images, the size will be automatically detected..
However, for older projects that uses Image Assets instead, you need to provide sizes for the launch screen. IE: "Default" images of the correct sizes of the screen as per:
https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/launch-screen/
Static Launch Screen Images. The names shall be: "Default-XXXh#ResY.png"
where XXX is the height and Y is the resolution.. Example:
iPhone 6 Plus - 1242px x 2208px - Default-736h#3x.png
iPhone 6 - 750px x 1334px - Default-667h#2x.png

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.

Xcode 6 Bug? Adding iPhone 6/6 Plus LaunchImage Changes App Constraints

I have my project setup on AutoLayout, works fine with iPhones 4 - 6 Plus. However, when I add in the LaunchImage for iPhone 6 and 6 Plus, the frames and constraints for the entire app no longer take up the entire screen. Instead, the entire app fits in the top left area of the screen.
If I remove the LaunchImages for iPhone 6 and iPhone 6 Plus, then the issue goes away and the elements of each View Controller once again have the correct coordinates and sizes.
I am using the following in Images.assets:
- 2x iOS - Portrait 7,8
- Retina 4 - Portrait 7,8
- Retina HD 5.5 Portrait iOS 8
- Retina HD 4.7 Portrait iOS 8
There are no warnings regarding the asset catalog, and all the LaunchImages are at the correct dimensions. I have attempted to Migrate the images over but with no luck.
When you don't provide iPhone 6 and iPhone 6 Plus launch images, iOS 8 simply scales your interface up (makes everything larger to fit).
Once you provide those images, you will now have access to the larger screen resolutions, and just because you use auto-layout, does not mean your views will resize. If you have constraints that are limiting the height and width of your views, you will get what you are seeing. I would check on your constraints on your views to make sure they are done properly and allow the view to grow when the screen size is larger than 320 x 568.

How to deal with iphone 6 size?

I launched my app on iphone 6 and 6 plus simulator. iPhone 6 plus uses #x3 images, but this have the same ratio. However, the iPhone 6 have a screen of 1334 x 750 (667 x 375) ... this sucks!
As you probably know, the app screen automatically fit to those new screen. But for the iPhone 6, images are bigger but they cannot be replaced (#3x is only for iphone6+).
How to deal with this new size?
I have to use autolayout only?
How to set the right screen size without automatically rescale this screen?
As Roger answered, you need to add the iPhone 6 and 6+ launch image
But you don't need to use autolayout. AutoLayout is one way of adapting to different screen resolutions, but the old autoresizingmask (springs and struts) is perfectly fine for most layouts. I use a combination of both as they each have pros & cons.
You need to do a couple of things:
Add a launch image for iPhone 6 and 6 plus.
adopt autolayout.

Resources