New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Output from a NSArray


Post Reply New Thread Subscribe

 
Thread Tools
a330

 
Member Since: Sep 20, 2009
Posts: 6
a330 is on a distinguished road

a330 is offline
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:@"/PDF"];
int i , count = [filePath count];
for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath is (%@)",[filePath objectAtIndex:i]);
[minFilesDislayoutput setStringValue: [filePath objectAtIndex:i]];
}
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
a330

 
Member Since: Sep 20, 2009
Posts: 6
a330 is on a distinguished road

a330 is offline
I can see what you mean....

Thanks for you reply!
QUOTE Thanks

Post Reply New Thread Subscribe


« "Getting my feet wet" or "Do I need a proper Mac to develop iPhone Apps" | change dmg icon »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Audio output problems m.watson Apple Notebooks 0 11-05-2009 08:18 PM
no sound output from internal speakers... zzzounds Apple Desktops 8 09-24-2009 11:09 AM
5.1 sound output??? Marlowkurtz Apple Notebooks 3 09-26-2008 03:25 PM
S-Video Output Problem macuser23 Apple Desktops 0 05-22-2008 08:46 AM
iMac G5 Sound Output Device question mint_mac_mini Apple Desktops 0 01-03-2006 07:02 PM

All times are GMT -4. The time now is 01:04 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?