• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Number of images in main bundle folder (iPhone)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Number of images in main bundle folder (iPhone)


  • Subject: Re: Number of images in main bundle folder (iPhone)
  • From: Alexander Spohr <email@hidden>
  • Date: Fri, 26 Jun 2009 19:35:12 +0200


Am 26.06.2009 um 19:17 schrieb Eric E. Dolecki:

This is what I ended up doing:

totalCount = 0;

NSArray *d = [[NSBundle mainBundle] pathsForResourcesOfType:@
"jpg" inDirectory:@"/"];

*// Loop through and find the JPGs that have "image_" in them*
for( int i=0;i<[d count];i++){
NSString *searchForMe = @"image_";
NSString *s = [[NSString alloc] initWithString:[d objectAtIndex:i]];

Why do you copy the path?

NSRange range = [s rangeOfString:searchForMe];

How about hasPrefix: ?

if( range.location != NSNotFound ){
totalCount++;
}
}


NSArray *d = [[NSBundle mainBundle] pathsForResourcesOfType:@"jpg" inDirectory:nil];
for(NSString *s in d)
if([s hasPrefix:@"image_"])
totalCount++;



atze _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Number of images in main bundle folder (iPhone)
      • From: Michael Ash <email@hidden>
References: 
 >Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: Alexander Spohr <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: Bill Bumgarner <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: Bill Bumgarner <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: glenn andreas <email@hidden>)
 >Re: Number of images in main bundle folder (iPhone) (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Number of images in main bundle folder (iPhone)
  • Next by Date: Re: NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error
  • Previous by thread: Re: Number of images in main bundle folder (iPhone)
  • Next by thread: Re: Number of images in main bundle folder (iPhone)
  • Index(es):
    • Date
    • Thread