• 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: Images in folder - simple question?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Images in folder - simple question?


  • Subject: Re: Images in folder - simple question?
  • From: Jeremy Dronfield <email@hidden>
  • Date: Wed, 28 Jan 2004 18:48:04 +0000

On 28 Jan 2004, at 4:47 pm, Dominik Gwosdek wrote:

It compiles without errors(yeah) but when I test the forwardButton I
get the following
error message:

2004-01-28 17:45:38.978 DDFCover[2061] NSImageCell's object value must
be an NSImage.

The array returned by -directoryContentsAtPath: includes invisible files inside the directory (contrary to the impression given by the documentation). I should have mentioned this in my previous reply. What you can do is pass the array, object by object, into a second array, excluding these invisibles (or anything else that isn't an image). For example, you could do it like this:

NSMutableArray *imageList; //<- set up and alloc'd elsewhere

int counter;
NSArray *filesList = [[NSFileManager defaultManager] directoryContentsAtPath:myPath];
int fileCount = [filesList count];
for (counter = 0; counter < fileCount; counter++) {
NSString *folderName = [filesList objectAtIndex:counter];

if (![folderName hasPrefix:@"."]) {
[imageList addObject:folderName];

}
}

This excludes those invisibles. A better way would be to change the if statement to,

if ([folderName hasSuffix:@".jpg"])

Hope this helps.
-Jeremy

========================================
email@hidden

theLocustFarm.net:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Images in folder - simple question? (From: email@hidden (Dominik Gwosdek))
 >Re: Images in folder - simple question? (From: Stefan Pantke <email@hidden>)
 >Re: Images in folder - simple question? (From: email@hidden (Dominik Gwosdek))

  • Prev by Date: Scrollable List of NSViews - NSTableView? NSMatrix? Other?
  • Next by Date: Re: removing focus rings
  • Previous by thread: Re: Images in folder - simple question?
  • Next by thread: Re: Images in folder - simple question?
  • Index(es):
    • Date
    • Thread