强制更新NSTextField

时间:2010-10-13 15:27:48

标签: objective-c nsstring nstextfield

我有一个NSTextField,当我的应用搜索数组时会更新:

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]]);

}

NSLog语句准确及时更新,但NSTextField需要一些时间来更新,有时会遗漏一些文件号(比如说复制Test.txt(10个中的3个)然后跳转到(9个中的10个) )

如何强制更新文本字段?不幸的是,没有重绘方法......:/

1 个答案:

答案 0 :(得分:2)

您可以尝试[progressLabel display]

相关问题