본문 바로가기
모바일개발(Mobile Dev)/IOS개발(ObjectC)

splash screen for all types of iPhones in XCode 6.1?

by 테크한스 2015. 12. 13.
반응형

I need to create and app which will run on iPhone 4S, 5,5S, 6, 6+ and the depoloyment target will be iOS 7.1. I saw Apple introduced LauchScreens.xib for creating the launch screen (Splash Screen) and also there is an Image Assets in which I can provide the Launch Images screens. See image below:

enter image description here

So my questions is how can I use the splash screen for all the iPhones? Or I should say, what is the standard way to to do that when I am using XCode 6? I have been looking for the answers since couple of days and reading blogs and Apple's Documents as well but I didn't find anything. Everything was singing its own song but not the answer. Please help ASAP. Thanks!

shareimprove this question
   
I don't understand. Xcode already provides hint of the resolution and format of the Launch images, and Apple documentation is already stated clearly. Just drag the images to correct placeholder. – Raptor Sep 22 '14 at 6:28
3 
@Raptor Then why there is LaunchScreens.xib? What is the use of that if I can use the imageAssets. This is confusing to me. – Developer Sep 22 '14 at 6:37 
1 
Also, what should be the naming conventions for the splash screens of iPhone 6 and iPhone 6+? Please share some link for the document if that exists. – Developer Sep 22 '14 at 6:39
   
There is NO LaunchScreens.xib. You created it? Splash screen does not use XIB / Storyboard. – RaptorSep 22 '14 at 6:44
4 
Create new project with XCode 6.1. then check! It comnes by Default. – Developer Sep 22 '14 at 6:48

In Xcode6 for all devices splash screen you need to make splash image for each device size retina and non retina.

Best way of done this thng use asset Catalog from target-->general like following screenshot:

enter image description here

when you tap the right small arrow near of launchImage (->) you can see the following window:

enter image description here

Currently there is empty because from right side there is no any target selected so if your deployment target is 6.0 you need to set check mark like following screenshot so you can see the all image need box :

enter image description here

See when you add wrong dimension image in catalog you can get warning at top right corner and when you tap on this warning you can get actually dimension. see the following screenshot for:

enter image description here

So from the warning log you can know which dimension image need for which splash screen.

Other way

No need to use Asses Catalog and no need to use LaunchScreen.xib you can still use old way:

create splash screen image with following size:

Default-568h.png                   320 x 568      
Default-568h@2x.png                640 x 1136
Default-667h@2x.png                750 x 1334
Default-736h@3x.png                1242 x 2208
Default.png                        320 x 480
Default@2x.png                     640 x 960

Now in plist you need to add following data:

  • Add one row by tap (+) its called UILaunchImages

enter image description here

  • and you need to fill this row like following

enter image description here

that's it no need to do any thing hope that answer helps to other as well.

shareimprove this answer
   
good answer give to you plus..... – Kirit Modi Jan 31 at 11:25
   
Thanks for wonderful answer. does naming convention matters for setting splash screen images in LunachImages folder in Asset Catalog or it may be anything? – iWatch Jan 31 at 11:50 
1 
I dont think but i used same name that we used normally – Nitin Gohel Jan 31 at 11:54
   
Thanks for this. I didn't realise that you can enable/disable splash screen sizes. Also "Asses Catalog". Heh. – Mr_Chimp Feb 4 at 13:21
   
Thanks ,it worked for me ..on Xcode 6.4,iOS8 – Abhishek Shukla Aug 21 at 15:56

I have been playing around Xcode 6 from sometimes now and what I found is LaunchScreen.xibworks for iOS 8 only, so if you want to provides launch image for all your devices, your app supports you can do as below..

For Device using iOS 7 you can do as usual, what we used to do using images.xcassetsenter image description here

For iOS 8 devices you have two ways..

  1. Simply you can use LaunchScreen.xib.enter image description herethis image show how Xcode by defaults sets LaunchScreen.xib for iOS 8 launch screen file.

    1. If you don't want to set LaunchScreen.xib as launch screen file and want to display some launch image as you want in iOS 7 device, so just remove launch screen file name and make it blank(see below image) and delete LaunchScreen.xib file from Xcode. In this case iOS 8 device also takes launch image from launch images from images.xcassetsenter image description here
shareimprove this answer
   
Great explanation!!! – ajay Aug 4 at 5:37

In Xcode 6.4, as of 2015-07-06 (yyyy-mm-dd), I used launch images rather than a launch screen file (.xib). This is targeting iOS 7.1+.

First, delete the entry from the Launch Screen File drop down. Leave this blank, if this points to a .xib the .xib will override the launch images source. Here is the setup in Target / General / App Icons and Launch Images. /Users/patrickweigel/Desktop/Screen Shot 2015-07-06 at 10.20.36 AM.png

Second, create a new Launch Image (NOT a new Image Set) after selecting the “+” at the bottom of the middle pane in Images.xcassets. Here is the pop-up after you select the “+”. enter image description here

Third, in the new Launch Image, there will be 20 squares, each asking for .png file. Now you need to create 20 .png files of the correct size. I used Pixelmator and exported each file as a .png. But what is the “correct size”? See below. enter image description here

Launch Images Correct Size Chart enter image description here'*No Status Bar

shareimprove this answer
   
beautifully explained bro.full marks – Krutarth Patel Oct 23 at 11:10

The new way of doing splash screens for iOS 8 onwards is to define a LaunchScreen.xib file. This is also available as a new Resource file type in XCode 6.

This new XIB will use AutoLayout and the new size classes to determine how you want to layout your splash screen.

It is not very clear how the backward compatibility of this will work if you want to support older devices. I figure it will not work.

You can set the launch.xib in the target properties first screen in your XCode project.

If you want to use the old way you can still define splash PNGs to use as launch images, that continues to be fully supported. From what I see, this is still the only way to go if you want to support old iOS versions.

Note that if you want to support the new resolutions of iPhone 6 / 6 Plus, then you must define either a launch xib or put the correctly sized PNGs in your asset catalog, or else you will get the blurry autoscaled UI that old apps get in compatbility mode.

shareimprove this answer
   
That is my question. If I use Image Catalog for launch image, what to do with LaunchScreen.xib? – Developer Sep 22 '14 at 8:18
   
Delete the xib. Remove the Launch XIB setting in the XCode target. It will automatically use the PNGs. Remember to clean the project, before your run it. – Dhiraj Gupta Sep 22 '14 at 9:20
   
So Dhiraj! Why Apple provided LaunchScreen.xib if we already had Image Catalog? Any idea or reference? – Developer Sep 22 '14 at 9:27
   
Supposedly, the XIB mechanism is better. You can design a single splash screen and have it work for all devices, and orientations. Plus, if you don't put images into the XIB, then the XIB will be smaller in file size than the combined file sizes of all the PNGs. – Dhiraj Gupta Sep 22 '14 at 11:17
   
I was also thinking the same to use the same XIB for all the iPhone devices but there will be an issue when you would be showing the logo of your company in the splash screen in the case of iPhone 3.5" because in that case image will be compressed. Moreover, app will use the same image for iPhone 5, 5S which it would be using in case of iPhone 6Plus. Isn't it?? – Developer Sep 22 '14 at 12:04
   
Standard layout, image selection rules apply as per AutoLayout and Size classes. Please refer to the WWDC videos on Auto Layout in Interface Builder for how to do this. – Dhiraj Gupta Sep 22 '14 at 12:25
   
Dhiraj Gupta Can you please share the link to that video? I didn't find that. – Developer Sep 22 '14 at 12:53
   
Just wanted to inform you that I am using Size Classes asl well along with the COnstraints! – Developer Sep 22 '14 at 13:00
   
Do you have something for me? – Developer Sep 23 '14 at 8:45
   
@DhirajGupta You inspired me. I created a LaunchScreen.xib with vectorized images for iOS 8 and It works very well. But I had to create a LaunchImage asset catalog for iOS 7 devices... please, see my answer in another thread: stackoverflow.com/a/26477333/3052059 – Thomás C. Oct 21 '14 at 1:02
   
@ThomásC. that's awesome. Keep up the good work! :) – Dhiraj Gupta Oct 22 '14 at 11:56
   
@Dhiraj Gupta pls let me know any option to localization both rusian and English. – annu Apr 9 at 11:52
   
@annu Wouldn't standard XIB localization mechanisms work? Haven't tried, but I think the way you localize XIBs will be common, across. – Dhiraj Gupta Apr 9 at 19:06
   
@DhirajGupta you are saying for localization in lunch option xib. – annu Apr 10 at 5:25
   
@annu Yes, why can't you localize it? If you're localizing other XIBs then this should be natural. Have you tried it? I would think that one of the main reasons Apple made the XIB launching possible was to be able to localize it. – Dhiraj Gupta Apr 10 at 5:36
   
@DhirajGupta Launch XIB not loading different in localization – annu Apr 10 at 6:03


반응형