Omnilogic Systems

  • Services
    • Mobile Apps
    • Custom Software
    • Cloud Solutions
  • About Us
  • Our Team
  • Jobs
  • Blog
  • Contact Us

Mobile and Custom Apps!

iOS Image Loading Rules

October 30, 2015

Apple documentation is not the best. One of our mobile apps requires display of images from multiple dynamic sources based on a list of precedence rules, prompting us to dig into Apple’s rules for image handling and priority. To save you time, here’s what we’ve found:

  • [UIImage imageNamed:@”my_image”] will first check the .xcassets asset catalog. If that fails, it will fallback to searching for any embedded images in your project of the same name.
  • [UIImage imageNamed:@”my_image”] will not scan any file system directories for images.
  • [UIImage imageWithContentsOfFile:path] can be used for either images embedded in your app or ones saved into the device file system, given the correct path.
  • The above functions will automatically take screen density into account. If you request “my_image.png”, theyย will automatically use “my_image@2x.png” if appropriate and the properly named file is available.

Now to write some custom image handling based on top of these built-in rules…

Filed Under: Mobile Development

Other News

  • Budget for Ongoing Mobile App Maintenance Costs
  • Your App Doesn’t Need to be Top 25 in the App Store
  • The 6-Step Program to Breaking Up With Excel
Follow Us
 
 
 
 

© 2024 - Omnilogic Systems Inc. - All Rights Reserved
Terms of Use - Sitemap

1635