UIImage imageWithXAssets

Sagar R. Kothari picture Sagar R. Kothari · Oct 10, 2013 · Viewed 18.6k times · Source

Assume I have two assets in my project or I may have even more assets under my project.

Multiple Assets


Name of image

  • Question 1: I can have multiple assets in one project & that is valid, correct?
  • Question 2: What if I set same name to an image-set in different xcode-assets? Example. "AppIcon" exists in AppImages.xcassets and 01 ConsumerSelectionVCtr.xcassets. Why compiler is not showing me errors for same image-set in multiple xcassets.
  • Question 3: How to load an image from xcassets?
  • Question 4: Is it preferable to use xcassets for all images in project?

Answer

David Snabel-Caunt picture David Snabel-Caunt · Oct 10, 2013

See the Asset Catalog documentation from Apple

  1. Yes, and this may help you to organise images
  2. I think one will overwrite the other. Don't give two 'images' the same name
  3. As before, use [UIImage imageNamed:@"LaunchImage"] for example
  4. Yes, apps deployed to iOS 7 can take advantage of an Xcode feature which reduces your app's download time (Xcode does this automatically)