【发布时间】:2010-10-13 15:27:48
【问题描述】:
我有一个 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 需要一些时间来更新,并且有时会遗漏一些文件编号(比如说 Copying Test.txt (3 out of 10) 然后跳转到 (9 out of 10) )
如何强制更新文本字段?不幸的是没有重绘方法...:/
【问题讨论】:
标签: objective-c nsstring nstextfield