views:

33

answers:

1

Hello,

I have a NSTextField that gets updated when my app searches through an array:

for (NSString *file in fileinDir)
{
        processedFiles = processedFiles + 1;

        NSArray*filesinDevice = [fm contentsOfDirectoryAtPath:[[dict objectForKey:NSWorkspaceVolumeURLKey] path] error:nil];

        [progressLabel setStringValue:[NSString stringWithFormat:@"Copying %@ (%i out of %i)",file,processedFiles,[filesinDevice count]]];

        NSLog(@"%@",[NSString stringWithFormat:@"Copying %@ (%i out of %i)",file,processedFiles,[filesinDevice count]]);

}

The NSLog statement updates fine and on time, but the NSTextField takes some time to update and sometimes misses out some file numbers ( like saying Copying Test.txt (3 out of 10) and then jumping to (9 out of 10))

How can I force update the text field? There's no redraw method unfortunately... :/

+1  A: 

You could try [progressLabel display]

invariant
tried this, but this will crash the app - BAD ACCESS Error.
David Schiefer
ok solved the crash error - but since my text field is on a NSMenuItem, it will deselect it constantly as soon as the text field's value changes.
David Schiefer
issue solved...
David Schiefer