作者nat626 (GarfieldCat)
看板MacDev
标题Re: [问题]Cocoa Applicatio选择多个档案并使用NSW …
时间Thu Dec 18 17:55:53 2008
自己问自己回答 :(
以下是更改後的code
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection:YES];
if ([openPanel runModalForTypes:nil] == NSOKButton) {
NSString *application = [[NSString alloc] initWithFormat:@"-a%@",
@"iPhoto"];
NSMutableArray *args = [[NSMutableArray alloc] init];
[args addObject: application];
for(NSString *file in [openPanel filenames]){
[args addObject:file];
}
NSTask *task = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/open"
arguments:args];
[task launch];
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.166.44.180