How to force universal app on iPad into scale mode? - ios

I created an universal iOS app. On all iPhone variants I want native resolution without scaling, so I created splash screen images for all available sizes in images.xcassets/LaunchImage.launchimage and set them all in Xcode:
Now, this works very well for all iPhone versions up to the biggest iPhone 6 Plus.
On iPad (with high pixel density) though I don't want native resolution. Instead I want it to scale the app (even if it looks a bit blurry then, but that's ok).
How would I do that?

In image assets you have to provide proper size for each launch screen, You can not use the same image for two devices in launch-images ( unless you have two copies of the same image ).
If you want to make app-size smaller, implement launch screen, set its background color to your desired background color and put your logo in the center of it. You can now remove iPhone 6,6Plus images from image assets, but you still have to provide launch images for iOS 7 devices (old iPhones / iPad ).

Don't use the Asset Catalogue. Create a LaunchScreen.xib , add a UIImage inside the view. Open the attribute inspector in the right hand panel and set the view mode to Aspect Fill.

The solution was quite easy, I simply changed project type from "universal" to "iphone" and that did the trick!

Related

How do you set up 'image sets' to match launchImage files for all devices?

NOTE: This question is NOT related to launch image storyboards.
INFO: BG Buddy is a landscape only app. The launch screen uses images in a launchImage.xcassets file.
The launch image transitions to a UIViewController containing a full screen UIImageView with the same BG Buddy Background image as used in the launch image, and some textual UIButtons. This gives the impression that the buttons appear on top of the background image after a short time when the app has loaded.
Here is how the BG Buddy Background image set has been set up since the app’s release. Transitions from Launch Image to UIViewController work perfectly on iPad, iPhones 5,6,7,8 and 6,7,8 Plus.
The iPhone X and the iPhone Plus both seem to use the iPhone 3x image slot but both have very different dimensions. I’ve opened up the other size classes slots and tried to find a place with much confusion and no success. NOTE: All iPhones apart from the iPhone Plus use compact width/compact height size classes when in landscape. The iPhone Plus uses regular width/ compact height in landscape orientation.
So how do you set up 'image set' files to match launchImage files for all devices?
At the moment I can either have a good iPhone X transition or a good iPhone Plus transition but not both.
Is my only option to try to detect if it’s an iPhone X (or iPhone Plus) and swap the images programatically?
So here's the solution for a landscape only app. Hopefully it will help a little for portrait orientations too. Landscape bespoke launch images should be placed as shown with these width/height class settings.
Use the launchImage.xcassets screenshot at the top of the question to set up your launchImage.xcassets.

Launch Screen File with different images

My design team has given me various launch screen images for all types of screen sizes found here.
I want to support iPhone 6+ and iPad Pro so I know launch screen files should be used instead of image assets.
However, how do I specify in my launch screen file the different images for each screen size? I thought size-classes would be the way to go but I can't differentiate between iPad Air 2 and iPad Pro that way.
There's also no iPad Pro image asset either.
You can look at device specific image assets (on the attributes inspector of an image in an asset bundle).
It may be impossible to match the design exactly because you can't run code at this point. It may be easier to explain this to the designers and have them design to the constraint.
One simple idea is to have a centered image at the correct resolution and to use a view underneath to have a background (color or tiled image).

Black bar appears on top when running on iPhone 6 & iPad Pro Simulator

When I run my game on the simulator, specifically on iPhone 6 and iPad Pro, it shows black bar on top of the screen. I have looked the answer up online and have literally tried every single thing and have went through all the answers, but none have worked. My deployment is set to 7.0 and have tried running with setting just set to LaunchImage from asset folder and LaunchImage & LaunchScreen.xib combined. I also do have the right size pictures required in asset including iPhone Retina 4, as well, and that doesn't fix the problem either. Is this just a glitch on the simulator or there is a way around this?
I got it working. For some reason my 2x images were short for the screen size, and had to extend them more. Even though height wise, my images had more length than the screen size.
Hope this helps people. I came across several people who had done everthing right, but still couldn't get it working. I believe it is because image isn't large enough to cover the whole screen
Stretched mode?
Are you providing Default screens in all sizes as suggested in:
Dealing with iPhone 6/6+ startup images
How to Update Your Apps for the 4-Inch iPhone 5 Display
Restoring integrity in Startup screens
Images clipped?
If not running in stretched mode, pick a View Mode best suited for your images, such as Aspect Fill and Scale to Fill, both of which will cover your UIImageView in LaunchScreen.storyboard.
Add Default-568h#2x.png Image with resolution 640x1136.
Make sure 'App Icons and Launch Images' look like below image:
it worked in simulator with iOS 9.

Do I need iPhone/iPad specific button images in my case?

Here is my situation: I have a simple app with some buttons that are images. I have the image set in xcode using the menu on the right (i simply click the button and pick the image I want from the dropdown). I created them using a simple image program so they look somewhat glossy and nice, but nothing crazy. I also sized them for an iphone screen.
Using some auto layout, I've been able to ensure the layout stays the same and the buttons change size with the size of the iphone. I would like this to be the case with the iPad as well, but I'm worried if they size too big, I'll lose image quality with the button images. I'm very new to layout and coding and have only been doing this development stuff for a little while. What are my options? I figure they are...(and these might not even be possible, throwing them out there):
1) Create two version of the app, one only for iPad and one only for iPhone with different size/quality images for each.
2) Code swift to identify the device and assign the different image accordingly
3) Pick a resolution for the iphone image that when expanded on iPad won't lose much quality
4) I'm overreacting and this isn't a big deal whatsoever since it's just a basic glossy button with some shadowing.
Thank you! Advice/links appreciated.
The better option to add images for both iPhone(retina/non-retina) and iPad(retina/non-retina). Put the high-resolution and original versions of your image in the same location in your application bundle.
Ones you added images same as the below naming format in to your application resources, the application will automatically pick the right one for you.
MyImage.png - Default version of an image resource.
MyImage#2x.png - High-resolution version of an image resource for devices with Retina displays.
MyImage~iphone.png - Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays.
MyImage~ipad.png - Version of an image for iPad.
MyImage#2x~ipad.png - High-resolution version of an image for iPad devices with Retina displays.

Simulator running in scaling mode for iPhone 6 Plus?

My app starts and runs on the new iPhone 6 Plus (or iPhone 6) in the simulator, but elements that I know are supposed to be small on the big screen (i.e. hard coded CGRects) are large, as if the whole app had just been scaled up for the larger screen.
How can I get out of scaling mode in the simulator?
It looks like setting a launch screen file in the "App Icons and Launch Images" section of your project settings, or adding iOS 8 images to your launch image catalog, will enable "native" resolution.
Adding a correctly sized LaunchImage seems to be enough (setting an incorrectly sized image won't).
Also adding the new "Launch Screen File" should work:
You must set correctly sized LaunchImages
For more information about LaunchImages and icons see this documentation
https://developer.apple.com/library/IOs/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
use Asset Catalog Creator from mac app store.
https://itunes.apple.com/gb/app/asset-catalog-creator-app/id809625456?mt=12
give it any image and it will generate all the correct launch images and icons in a xassets file.
This should stop the scaling of the whole app on iphone 6+

Resources