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 7597445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:09:30+00:00 2026-05-30T22:09:30+00:00

Hello I got an issue with this for (NSString* fileName in fileList){ if (

  • 0

Hello I got an issue with this

for (NSString* fileName in fileList){
    if ( [fileName rangeOfString:@".png"].location != NSNotFound  ) {
        int x= col*130;



        NSLog(@"add %@", fileName);

        //create dynamically a nice thumbnail 
        UIImage* img = [UIImage imageWithContentsOfFile:
                        [self.documentsDir stringByAppendingPathComponent:fileName]
                        ];

        UIImageView* imgView = [[UIImageView alloc] initWithImage:img];
        imgView.frame = CGRectMake(0, 0, 110, 110);
        imgView.contentMode = UIViewContentModeScaleAspectFill;
        imgView.clipsToBounds = YES;

        UIButton* imgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [imgBtn addTarget:self action:@selector(imgPressed:) forControlEvents:UIControlEventTouchUpInside];
        imgBtn.frame = CGRectMake(x, row*130, 120, 120);
        //imgBtn.backgroundColor = [UIColor lightGrayColor];
        [imgBtn addSubview:imgView];

        [self.canvas addSubview:imgBtn];

        [imgView release];


    col++;
        if (x > 760) {
            row++;
            col = 0;
        }
    }

this makes really nice thumbnail, but i want to make it with only files with specific name, so i have problem how to load only the specific name types. like e.g. I have images named …city1,city2,city3, all are types png, and i also have car1,car2 …. also png. But once I want to load only cities and once only cars….

Is there any possibility to load only cities or only cars????

Thanks to all.
I don’t know how to make the exact comparison to string.

I would use something like this
if(filename isequaltoString:@”car%”)

but it doesn’t work.. =(

  • 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-05-30T22:09:32+00:00Added an answer on May 30, 2026 at 10:09 pm

    You already have code to almost handle this…

     if ( [fileName rangeOfString:@".png"].location != NSNotFound  ) 
    

    You just need to check for @”car” or whatever you are looking for, and you can’t just check the location property or NSRange, because if you match at the first character index 0 your test above will fail.

    Return Value
    An NSRange structure giving the location and length in the receiver of the first occurrence of aString. Returns {NSNotFound, 0} if aString is not found or is empty (@””).

    You should check length as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello folks, I've got the issue to add a browser event to some input
I got this code ` // // prints out Hello World! // hello_world(); //First
I got this code in my submit form <form id=myform action='hello.php' method='GET'> <input type=button
I'm stuck with this pretty silly thing; I got a textfile like this; Hello::140.0::Bye
Hello all i got a mail code like this body = Dear & cName
Hello got typed Dataset named DSMain. Tables User: U_id int U_fname string U_lname string
I was just going through certain interview questions. Got this structure related issue, I
Hello I have got this php order by annotations on my one to many
hello i got a batch file, something like this: if %day%==monday, tuesday, wednesday, thursday,
I've got a bunch of strings like: Hello, here's a test colon&#58;. Here's a

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.