title: How To Load The Image Set(The Bundle) From Images.xcasset in iOS
body: <p>When I am developing apps in iOS before, I always put the image sources of the app at the root directory of the project, and then I will load them using <code>[UIImage imageNamed:@"image.png"]</code>. I did't even include various sizes and resolutions such as image@2x or image@3x. But I am afraid this is not a good practice, because I cannot deal with different screen resolutions. </p>
  
  <p>Now, I want to make use of the <strong>Images.xcasset</strong> to store all my image sources so that I will be able to load just the bundle name, and hoping that the system will pick the image with the right resolution automatically. Therefore, I made a test and place my image set under <strong>Images.xcasset</strong> and named it as <em>images</em>, and then in my UIViewController.m I am trying to load the image by calling <strong>[UIImage imageName:images]</strong>. As a result, it didn't work. So I searched for an answer and found out that I should call <code>[UIImage imageName:@"images60x60@2x.png"]</code> in order to load the the 60pt @2x image. </p>
  
  <p>But I think this still did not solve my problem, because I am still choosing which image to load. Is there a way to load the entire image set or load the image according to the resolution of the screen?</p>
  
  <p>Please help. Many Thanks.</p>
  
  <p>EDIT: Added Screen Shots</p>
  
  <p><a href="https://i.stack.imgur.com/8qsUk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8qsUk.png" alt="enter image description here"></a></p>
  
  <p>I use AppIcon as a test</p>
  
  <p><a href="https://i.stack.imgur.com/2VUWJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2VUWJ.png" alt="enter image description here"></a></p>