Re: [問題]Cocoa Applicatio選擇多個檔案並使用NSW …
自己問自己回答 :(
以下是更改後的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
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章