Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:23:04+00:00 2026-06-11T00:23:04+00:00

I need to get the value of a UIImage’s image as a string. Previously

  • 0

I need to get the value of a UIImage’s image as a string.

Previously I was doing:

if(images[imageNo].image == [UIImage imageNamed:@"image1.png"])
{

But now I have a lot more conditions so I would like to use a switch, doing:

switch(images[imageNo].image)
{
    case @"image1.png":
    break;
}

Is there a way to achieve this? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:23:05+00:00Added an answer on June 11, 2026 at 12:23 am

    Both of your approaches are incorrect. The first one relies on caching (which is not documented), meanwhile the second is a syntax error – the ‘case’ keywords expect a compile-time constant expression.

    As far as I know, there’s no such a method in the iOS SDK that would return an image’s filename – simply because it’s not a property of the image (what would it return for a programmatically created image?). You should instead try to operate on an NSDictionary, storing the UIImage objects associated with the filenames as keys, and comparing the keys using isEqualToString:.

    So you should create your images only once, and store them in a dictionary:

    // assuming `images` is an already created instance variable of your class
    [images setObject:[UIImage imageNamed:@"ImgOne.png"] forKey:@"ImgOne.png"];
    // and so on, with every image you need
    
    // then once you have to check against a file name, use:
    UIImage *img = [images objectForKey:@"FileName.png"];
    if ([someImage isEqual:img]) {
        // you can now be sure that the image set to the object was once named "FileName"
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get a value from another page. But I get this error
So I need to get value false or true if string contains not only
Need to get a value of an enumeration of a given string literal like
I need to get value from json. It works perfectly on returned objects, but
I need to get attribute value of clicked element, but I have an ajax
I need to get string value from WPF Window class? For example I have
I need to get a value from an input, but the id always change,
I have following string: {_id:scheme_version,_rev:4-cad1842a7646b4497066e09c3788e724,scheme_version:1234} and I need to get value of scheme version,
For example i have this xml. I need to get value of parameter val
I need to get the value from a checkbox which is not hidden. Here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.