Output from a NSArray

Joined
Sep 20, 2009
Messages
6
Reaction score
0
Points
1
I have this code, that should list the files in a folder, in Debugger console it is working and displaying my files. But i my app, only the last file is displayed. What am i doing wrong..?
(I am a totally newbee in cocoa)

IBOutlet NSTextField *minFilesDislayoutput;


NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:mad:"/PDF"];
int i , count = [filePath count];
for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath is (%@)",[filePath objectAtIndex:i]);
[minFilesDislayoutput setStringValue: [filePath objectAtIndex:i]];
}
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Because you keep resetting the minFilesDislayoutput value through your loop to the value at the index you are at. You are not appending the value.

I haven't played with NSTextFields like you are trying to, so don't know have a solution. Perhaps you want to look into NSTextView.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top