This has been an amazingly exasperating and non-transparent process.
So far, from this question I have figured out the different dimensions of launch images I needed and that I can safely not use launch xibs / storyboards if I already have the launch images, and from various posts I have determined that the naming convention (APPARENTLY??) should be Default#2x.png for iPhone 4s, Default-568h#2x.png for iPhone 5, Default-667h#2x.png for iPhone 6, and Default-Portrait#3x.png for iPhone 6+, although I have seen conflicting information on this so I'm not even sure....do I need ~iphone appended to the names?
BUT THEN, I go to add them to xcode so I go to my images.xcassets thing and select "new launch image" and this chart thing appears that makes zero sense to me....it only has space for one landscape picture, "Retina HD 5.5", but not for the other landscapes....even though the project is supposed to be portrait-only anyway...and if this thing is keeping track of my images then what do I need the naming convention for? This is so confusing.
Okay, the easiest way to make a nice launch image is to use a xib. You won't have to worry about naming conventions and it will scale beautifully across all your devices.
Step 1:
Your project should come with a file called LaunchScreen.xib. If you don't see one like that, hit File > new File > User Interface > Launch Image.
Step 2:
Open the xib and click on edge of the xib. Then, click on the Attributes inspector. Set the size to whatever you are using in the rest of your app. We are taking advantage of the auto layout and so the image should be resized to fit other devices.
Step 3:
Drag in an image view and resize it to fill the xib. Insert a high resolution version of your splash screen.
Related
So I have a fairly old app, last time worked on before iPhone X(s) was released. Always used Launch Images Source instead of Launch Screen File as seen below.
I am now having issues launching on iPhone X, as the screen size is assumed from the LaunchImage and there is NO launch image currently provided for iPhone X(s) in the "LaunchImage" file of .xcassets folder.
What is the most straightforward way to abandon using cassets in use of the new "Launch Screen File"? I have already tried creating this and using it, but had no luck getting an UIImageView to resize an image with said screen sizes on devices.
Im really looking for a straightforward guide for creating a LaunchImage.storyboard file that can adapt a launch screen image(full-sized image) to any device size.
What is the most straightforward way to abandon using cassets in use of the new "Launch Screen File"?
Change the Launch Images Source pop-up menu to "Don't use asset catalogs".
Make a LaunchScreen.storyboard if there isn't one, and point Launch Screen File at it. Make sure your launch image storyboard uses autolayout and is designated as a launch screen.
Now configure your storyboard's view controller using autolayout so that it lays out correctly on all devices.
I'm trying to create an new asset catalog for universal project (iPhone and iPad). I add new xcassest:
But As you can see in case of iPhone only shows one option for 2x. In my case I need to add backgrounds and for both 4-4s and 5-5s phones the images are 2x also is not showing an option for the 6/7 and is also 2x.
My question to guys is how can add the assets for every screen size in my xcassest file.
I'll really appreciate your help.
Nothing is "missing". Screens can come in different resolutions, and all possibilities appear in the screen shot. So every image in your app will come in three versions, and slots are provided for all of them. (You should use "Universal" unless the images for iPhone and iPad are truly different from one another, i.e. different content.)
As for image size, just use a size that works with the largest screen and permit the image view to scale it down as needed (or, for less memory waste, scale it down in code yourself at runtime).
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).
I am currently developing an ios app and the scope is limited to iPhones only and portrait mode only.
In each screen there are images, buttons, labels and textFields. The question here is, how do I render appropriate image for device from the Images.xcassets?
What I am doing now, written below -
From Sketch design application, exporting my images for 1x, 2x and 3x (Screens designed by a UI designer)
Adding them to Xcode project (drag and drop from finder to xcode)
Add new image set in Images.xcassets (naming it as "MyImages") and drag drop my images for 1x, 2x, 3x.
In the storyboard, on a viewcontroller, adding an ImageView
For the image view, selecting Image as "MyImages" from Attribute Inspector.
Once the above steps are complete, when I test the app on simulators starting from iphone4s, iphone5, iphone5s, iphone6 and so on.. (all the simulators available on Xcode 7.3), I don't see the appropriate image is being rendered.
Is my approach correct?
Also, how do I debug a UI element on the screens? Like, how/where do I check for what image is rendered? Its size (W X H)?
Added Screenshot
#Lohith Korupolu:
The screen shot you provided is for universal size (iPhone/iPad). From the additional information provided in comments, this would lead to issues with AutoLayout constraints that would stop the image showing on screens of a smaller size than that shown in your StoryBoard.
E.g. I have replicated your issue on storyboard...
This results in the following in Simulator for iPhone 4s....
i.e. Text is there but NO IMAGE.
REASON: The autoLayout Constraints set for the larger "Universal" Screen on any of two opposite sides would make the image invisible/ disappear when viewed on a smaller screen.
SOLUTION:
1. Clear the Autolayout constraints for this selected Image in Storyboard. See next picture...
2. Add AutoLayout constraints as below x2 pictures. (Top constraint, Height + Width) (horizontally in container). Remembering to tick "Items of new constraints" for both.
3. Run Simulator for iPhone 4s... E.g.
** The same situation is occuring with the other iPhone size simulator Runs. **
****** All Working ******
They should all be 2x images for iPhones apart from the plus size iPhones which should be 3x. Is that not what you are seeing?
In terms of debugging / checking this - you can put place holder images in your assets with labels or different colour tints to distinguish them from each other and then replace them later with images that give the desired final appearance once you know that everything is working as expected.
Using 2x images for iPhones approach works fine, however, there is another more straight forward way without having to resort to multiple image files for 1x, 2x, 3x in Xcode, by use of good large quality PDF (vector).
1. Create a Large PDF of the image/Graphic image you want to use
2. Import it into 'Assets.xcassets' - drag and drop (Into Xcode)
3. Go to the utilities panel on the right for the 'Attributes Inspector' (when the image is selected)
See Screen shot (a)
Under 'Scale Factors' the selection from 'Multiple' to 'Single Vector'
Now when you got to 'StoryBoard' and add the image - Simply select the PDF's name.
Xcode will automatically render it to correct size etc at run time for you. All the work is done by Xcode.
Exceptions:
It does not work well with images for icons inside the TabBar or Navigation Bar Items.
Note:
Vector graphics are sharp and ideal for High Definition (HD), but although Xcode accepts the Image Asset as a vector from the PDF, it doesn't seem to keep the vector but converts it into an actual image with pixelation problems when zoomed in, from a HD perspective.
I have been reading through all the answers, but still can't figure out to what I'm doing wrong. I went to Project -> General -> Launch Image Source and set that field to LaunchImage, which is in my Assets.xcassets. I have left Launch Screen File field empty. I read at several places to delete LaunchScreen.xib file, but I don't have that in my Xcode project. I also have the right sizes of images that are required by apple for Launch Images. What should I do?
Select Project and go tab General. Make sure you have set image folder and remove lauchscreen.xib
Select arrow and go to folder. make sure you check:
Maybe it will help you.
But I strongly recommend you: use lauchscreen.xib or .storyboard. It is more better than using lauchImage. If you use lauchingScreen, you should use like this::
Drag image to xib , and set image to this imageview check option use as lauch screen on right side of xib file. It will work like a charm :)
Try adding the launchscreen image as the background image of you launchscreen.storyboard
You might want to try adding the retina images to your app. For me this did the trick. No launch image was shown on my simulator before adding them.
Please remember that you need portrait and landscape if your app does both.
LI retina 5.5 is size 1242x2208 retina 4.7 is 750x1334 (portrait) and opposite for landscape is true ie. retina 5.5 2208x1242 4.7 1334x750
Retina launch images are needed for ios 8/9