Assets in asset catalog inaccessible to storyboard - ios

I am migrating a project to iOS 9, and I want to place all my images into an asset catalog to take advantage of app thinning.
So far I have created an asset catalog in my project with all the images in the project, and I have removed the individual image files from the project.
The app runs, and on the simulator the images appear, but when I look at the storyboard, there is now a blue "?" box where each of the images should be.
How can I get the storyboard to recognize the assets in the asset catalog?

Related

Where to store images in iOS project

I'm new to iOS development. I have created a simple iOS app where I have many buttons with images inside. Also cells of UITableView in my application contains images.
Up to now I have put all images for buttons and cells in the "Assets.xcassets" folder. The images can also be accessed if I locate all images in separate directory (let say "Images" folder).
Where is the correct place to locate images? As far as I know in "Assets.xcassets" app logo, tab bar icons can be located, but I don't know is it allowed to store all images in that folder.
You can store any resource you like in the Assets.xcassets folder. Simply drag and drop the images into the Assets.xcassets folder and use them. There is no limit to what type of asset you put in the Assets.xcassets catalog. Of course, you can add a new asset catalog. It can be found in File > New > File, scrolling down to Resource and then clicking Asset Catalog. It acts the same as Assets.xcassets and the usage is the same.
For example, if you put an image called foo in an asset catalog called Bar.xcassets, you can still use
UIImage("foo")
without specifying the name of your catalog.
In general you should use assets for all static images you have in an app. Assets were introduced for a better handling of images with different resolutions for different devices (like #2x, #3x for retina devices). When user installs the app not all versions of the same image are downloaded but only that one that fits the best user's device. So your app will take less space which is good. Also assets are more convenient if you have several versions with different resolutions for the same image.
If you want you can place images in several assets. To add a new asset go to File > New > File and choose Asset Catalog in Resource section.

Images in Assets Catalog need to be included in XCode project?

I have images in the Assets Catalog.
I added them by dragging images from the XCode project view (they are included in the project) into the Assets Catalog.
Once images are in the Catalog, can i delete them from the project itself?
Yes, you should be able to remove your images from the Xcode project view.
Once you drag them into the Asset Catalog, they're duplicated in the folder where the asset is stored. So you won't need them in the project view anymore.

Launch screen custom image for iPad

I need to present different image on the launch screen for iPad.
Our designer provided only 2 images:
one for iPhone portrait
one for iPad landscape
So I cannot use Launch images and assets catalog
Instead of that I'm trying to use LaunchScreen.xib,
I'm trying to name them like it is described here https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html
with ~ipad and ~iphone postfixes
But I didn't manage to figure out how I should place them in the assets catalog
How can I present different images for iPad and iPhone
I found out that it could be done with right click on the detail asset view in xCode
Try to open assets catalog in xcode and choose LaunchImage.
Next right click and select New Launch Image.
After that you will have new asset. image here.
Put you images there.
Next step is delete old LaunchImage asset and rename new.

How to display an image from Asset Catalog in Today Extension?

I'm working on a Today Extension for iOS8. My App Group is set up correctly and I can successfully use NSUserDefaults to send simple bits of data to my extension (using this tutorial).
In the storyboard for my extension, I've placed an image onto the storyboard and set the image to be an asset I have in my Asset Catalog. Even though it appears in Interface Builder, when I run the app on a device and simulator the image doesn't display.
What am I missing?
Make sure the asset catalog is included in the target for your Today extension.

where did the icons/launch image table go in xcode 6?

If you look at this thread
iOS 7 App Icons, Launch images And Naming Convention While Keeping iOS 6 Icons
You see that xcode used to show a nice table where you could see all icon/launch image dimensions, what is missing etc.
I just managed to start migrating our app to ios8/iphone6 so i also upgraded xcode. However, now i can't seem to locate that table anymore, all there is is an empty section with buttons to "use asset catalog":
So, i have 2 questions:
is the table somewhere else, or is "asset catalog" the way to go now?
I tried the asset catalog, and all images are copied into this xcassets catalog. Is there any reason for me to keep the original files in the project? Do i need it for anything else, like ios5? I looked around but found no answer.
Thankful for some pointers.
Use the Asset catalog , this is the preferred way now.
If you use the asset catalog, all the images will be copied to images.xcassets, there is no need to keep the original files. If you control click the assets and show in finder, you could find the copied images. In asset catalog you have options to give different images for iOS 5,6,7 landscpae or portrait whatever is appropriate for your app.

Resources