Getting the Unity iOS Splash Screen - ios

My app has splash screens of varying sizes for different iOS devices. They are registered in the Unity PlayerSettings for iOS under 'iPhone 3.5"/Retina', 'iPhone 5.5" Landscape/Retina', etc.
My first scene is a loading scene that should look exactly like the splash screen (more initialization is going on under the hood).
I want to grab the splash screen asset that was used and place it in my loading scene, but I'm not sure how to determine exactly which asset was used.
I suppose I could build a lookup table keyed on strings returned by SystemInfo.DeviceModel, but that seems fragile. I'd much rather use however Unity determines which splash screen to display, but I haven't been able to find how that happens.

1. Check the device resolution
You could check for the device resolution using Screen.width and Screen.height:
iPhone 3.5": 480 x 320 / 960 x 640 (retina)
iPhone 4": 1136 x 640
iPhone 4.7": 1334 x 750
iPhone 5.5": 2208 x 1242
iPad: 1024x768 / 2048 x 1536 (retina)
2. Use the same image for all devices
I don't know how's your splash screen set up. But what I did on a previous project was to use the same image for all devices. Basically I just used the 4:3 (iPad (retina)) version and made a script that scaled it to fit it's width and just cut of the top and bottom area on devices with a wider screen.
Depending on your GUI system you may just anchor the image to the edges of the screen.

Related

App not running properly on iPhone 6 simulator

I am stuck with this weird problem. When I put Launch Screen File (Under General Settings tab) as empty, app runs well on 4s, 5, 6.
But when I put some Launch Screen for app, it gets scaled on iPhone6. Any help on this would be appreciated.
Check your splash screen size
splash screen must be
2x 640 × 960 pixels
ratina 640 × 1136 pixels
ratina hd 4.7 750 × 1334 pixels
ratina hd 5.5 1242 × 2208 pixels
and also use autoresizing mask
set property in your image and view
You getting problem because you may not using Ratina HD 4.7 (750X1334) Launchscreen.
Include launchscreens for every resolution shown in below image, then it will run perfect on all your iPhones.
Or you can check also full tutorial about Launchscreen
http://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/launch-screens/
You should not add splash images for the Retina HD 4.7, Retina HD 5.5 in your launch images, when you add these it means your app is compatible with iPhone 6, iPhone 6+ respectively. And by screenshot i can see that you app is still not compatible with iPhone6, iPhone 6+.
When you don't add splash screen the UI is automatically scaled up by the IOS to fit the bigger screens. SO your all UI scaled autmatically so it looks fine.
But when you add splash screen it will take the frame and size as it is.
You can solve it by using autolayout and size class.

iOS background size of images

What size of image I need to have if I want to use it as background to full screen?
1.png 320 - 568 points non retina
1#2x.png 640 - 1126 points retina
Am I right? Or what size are correct?
You could use the size of the splash screen images for your views too, making your app iOS 7 forward compatible.
For iPhone 5 and iPod touch (5th generation):
640 x 1136 pixels
For other iPhone and iPod touch devices:
640 x 960 pixels (retina)
320 x 480 pixels (standard resolution)
It depends on what device you're targeting. If you looking at just the iPhone 5/5s then you're spot on. If you're also taking into account everything below the iPhone 5, then you will also need
320x480 (non retina)
640x960 (retina)
So it just depends on the devices you're supporting. There are loads of resources on the net about these things. Also bear in mind that the background size will be different depending on what components you use, such as navigation bars and tab bars. And also if you're supporting iOS 7 then the status bar is transparent, where as on iOS 6 and below, you don't need to provide the background for that (so the above dimensions are actually correct for iOS 7 but not exactly right for iOS 6)

using 1136 x 640 images in storyboard

EDIT: Dont misunderstand. I get that I can put in myImage.png whose size is 568 x 320 and myImage#2x.png whose size is 1136 X 640 and, at run time, iOS will show the lager image if the device has a retina screen. That is not what this is about. Im talking strictly about placing a 1136 x 640 image in the storyboard.
Some details:
Using xcode 5
iPhone only app (iPhone 4 and above ideally)
Targeting iOS 7 (should keep out any iPhone 3gs ...right?)
Single view app
Using storyboards
My understanding is that I can provide only the higher resolution 1136 x 640 images my app needs for the iPhone 5 then use autolayout to constrain things in such a way that my UI works properly even if the device is an iPhone 4 and has less screen real estate.
My issue is that if I drag a 1136 x 640 image onto the storyboard the image is 2X the size of the view im dropping it into. I get that I can resize the UIImageView and set the mode to aspect fit and the image will display correctly in the view.
However, that would get quite annoying. Is there a way to just set the storyboard to use the retina images directly?
Now I can create images that are half the size (568 x 320) and those will drag and drop into the views perfectly. But I cant imagine why anyone would want to do that. This doesnt make sense to me. I would expect the SDK to let me layout the app in the highest resolution possible.
I tried using images named myImage.png and using myImage#2x.png but neither changed anything.
Don't think of the dimensions in Xcode as pixels, but points. So while you set the image dimensions to be 568 x 320, the #2x images are going to use two pixels per point.
What are you testing on? You might not be seeing a difference because you are only testing on retina devices. If you are only planning on supporting iOS 7 (iPhone 4 and up), you won't be using any non-retina devices.

iPhone Launch image for a landscape based application

The problem is that the launch image I have set up isn't showing up I speculate its because its dimension are for portrait but since its landscape based it isn't showing up and I have set up all my launch images correctly on the asset catalog now the thing is I don't know if I'm supposed to set it up as portrait under Deployment info and later then coding for it to once it has completely launched and loaded to stay in landscape and not rotate to portrait I notice that on my asset catalog I don't have an image with the dimensions 320x480 it never asked me for it you know how it has slots well in my project it never gave me one pertaining such dimensions (320x480) it only had two slots for iPhone portrait which were "#2x" (640x960) and "R4" (640 x1136)
Update
I tried changing the dimension from 640x960 to 960x640 but I got an error as soon as I added to the catalog because those weren't the right dimensions
More Details : apple doc
portrait only available in xcode for launch image but you can customize your image. create image landscape mode the portrait size through attached to xcode. it's works perfectly and display image as landscape
Create launch images in different sizes for different devices. Launch images for all devices must include the status bar region. Create launch images in the following sizes:
For iPhone 5 and iPod touch (5th generation):
640 x 1136 pixels
For other iPhone and iPod touch devices:
640 x 960 pixels
320 x 480 pixels (standard resolution)
If at all you still want to view the splash screen in landscape mode you have to design the image in such a way as we cannot change the behavior of the splash screen.
Instead of designing the image as 640x960, design it as 960x640 and your problem will get solved.
Edit:
This is sample splash image in portrait dimension but designed in landscape view
All the best.
The iPhone only uses ONE launch image -- portrait
only the iPad supports orientations during launch
what many do:
have no launch image
make sure applicationDidFinishLaunching returns as soon as possible(!)
show your own splash screen view
do your real loading only THEN
I was going to comment on #Warrior's answer but StackOverflow won't let me.
You shouldn't need to specify an iPhone 5 optimised image (I haven't for my app and it works), although if this is a new app I would recommend it.
Are you running it on an iOS 7 device?
I have noticed that Xcode allows you to add a 1x and 2x image specific to iOS 5 & 6 devices.
Otherwise all I can suggest is checking your dimensions (it must be a portrait sized image 640x960px) and be placed in the '2x' slot) and also make sure your info plist is pointing to the correct location.
Then as others have suggested, all you need to do to get a landscape image is have artwork that is rotated 90 degrees when your image is portrait.
The screen size and Icon size for iOS.
ICONS (iPhone and iPad)
29 x 29pt (1x and 2x)
40 x 40pt (1x and 2x)
50 x 50pt (1x and 2x)
57 x 57pt (1x and 2x)
60 x 60pt (2x)
72 x 72pt (1x and 2x)
76 x 76pt (1x and 2x)
NOTE: 2x is double the size of 1x images
SCREEN SIZE
iPhone 4s and earlier (3.5 inch)
320 x 480 pts
Retina
640 x 960 pts
iPhone 5 (4 inch)
320 x 568 pts
retina
640 x 1136 pixels
iPad protrait
768 x 1004
retina
1536 x 2008
iPad Landscape
1024 x 748
retina
2048 x 1496
OTHER IMAGE SLICING
All image slicing requires both 1x and 2x to work perfectly for retina and non retina displays.
NOTE: 2x is double the size of 1x images.
Normally you add both a portrait and landscape image to the asset catalog and the device chooses which one to use based on the current device orientation.
If your app only supports landscape then you only need to provide a landscape image, as long as you set the "Device Orientation" in your info plist to be "Landscape Left" and "Landscape Right" ONLY.
In that case, the user will always be presented with a landscape launch image and this will indicate to them that they need to rotate their device.
- Anthony

App without splash screen (Default.png) is a reject reason?

In a universal app, you have to add 6 splash images named Default.png.
320 x 480 for non-retina iphone
640 x 960 for retina iphone
768 x 1024 for non-retina iPad-portrait
1536 x 2048 for retina iPad-portrait
1024 x 768 for non-retina iPad-landscape
2048 x 1536 for retina iPad-landscape
What if I'm fine with that black screen displayed when you don't provide any splash screen image.
Does Apple reject apps just because of this? I couldn't find anything.
Do I have to create 6 useless black png's and add them to the project?
iOS Human Interface Guidelines says explicitly:
To enhance the user’s experience at application launch, you must provide at least one launch image.
The launch image is there to be displayed while your app is loading and have to look like the first screen of your app:
A launch image looks very similar to the first screen your application displays.
So yes, you have to provide launch images, and even if you are happy with just a black launch screen, this is not enough unless the first screen in your app is actually just a black screen?

Resources