How to add iPad and iPhone assets quickly? - ios

When I import an image, it gets placed in "Universal". Is there a way to tell xCode directly that that image is designed for iPad at #2x, and that image is designed for iPhone at #3x, and put those 2 together if they have the same name? Now I need to add everything manually, which takes a long time...
Thanks.

Edit: further detail (cause I probably misread your question a little)...
Xcode should already be doing that for you... I just tried it:
cat#2x.png
cat#3x.png
cat#2x~ipad.png
Select all three, drag and drop them into Assets in Xcode, and I automatically have a resource named "cat" with both 2x and 3x iPhone versions and a 2x iPad version.

Related

Duplicate images in my assets.car

So I was snooping around in that achieve trying to make my app smaller. And I found something odd!
There are two identical copies of every image! One with an ending "~iPad" and one with "~iPad#2x"
I understand the purpose of having those two endings, but when I am setting up the .xcassets the way I am.... I don't expect the app to need it. Is there any way to get rid of the duplicate?
Here is how I have set up one of my entires:
You should use universal image asset instead of separate for iphone and ipad.
from assets select this image set and from attribute inspector uncheck iphone and ipad under Device and check universal from it.
So you will get universal imageset with 1x,2x and 3x will automatically used by iphone and ipad both.
If you are using different size of images for iphone and ipad then you must set separate images for iphone and ipad but if you are using same image size then you should use universal as i mentioned above.
Hope this will help :)

Why isn't my launch image loading when the app starts?

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

Where to put launch images?

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.

Debug on iOS device gives wrong screen size

I'm trying to run my application on an iPod 5 (4inch retina screen) but it shows the 3,5 inch version of the application.
On an iPhone 5S it does show the correct screen size. Are there any known settings to accomplish a setup like this and how can I turn it off again?
You need to make sure that you have all the images set in the LaunchImages.
You can find this in the images.xcassets of your project in xcode.
Apparently you also have to assign the Image asset to the project. In your target you see the asset to choose from in the 'app icon and launch images' section, here it pointed to an old & renamed asset.
Changed it to the correct one, removed the derived data and it worked.

Put All Images in Asset Catalog?

I started a new project in Xcode 5.
What is this Images.xcassets shenanigans?
Am I supposed to put the various images I'm using for my app (like button images & stuff) in there or only the AppIcon & LaunchImage?
I see I can create a new folder in Images.xcassets. Should I create a folder called "Button Icons" or whatever and just throw them in there?
See, but I just want to add some retina images to my target.
I'm only supporting iOS 7. So, I don't need to worry about other formats like non-retina.
Why did they make this so complicated and not document it at all? Why do I need these extra Contents.json files?
It looks like I can uncheck (remove) Images.xcassets from the target but not the individual image files within the asset catalog.
Can I just do things the old way or would I be missing out on compression/performance enhancements?
Is there a setting I can set so that my app treats all image files as retina images even if they dont have the #2x suffix in their filename?
In the "What's New in Xcode 5" WWDC 2013 Session Video, the speaker says Image.xcassets "collects all of your image-based resources, such as your launch images, icons, loose images that you use in your project, together into one place."
"Also, Xcode knows about new iOS 7 APIs and so can even optimize the loading of your image-based resources." I'm assuming "it does it for you automatically" as long as you put your images in Image.xcassets (or another asset catalog included in your target).
So, I suggest you suck it up, and adapt or die.
I don't know.
There are not retina devices that are still supported by iOS 7 such as iPad mini and iPhone 3GS. Keep that in mind. The images will scale down and still work but I wanted to make sure you knew iOS 7 supported not retina devices.
When you ask for an image by name iOS will look for the image by name. For example, "background.png" if there is a retina image "background#2x.png" and the device is retina iOS will handle that for you. If you only plan on providing retina images there is nothing wrong with making the images all retina and excluding the "#2x" info in the image. name.

Resources