Re: [問題]Cocoa Applicatio選擇多個檔案並使用NSW …

看板MacDev作者 (GarfieldCat)時間16年前 (2008/12/18 17:55), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
自己問自己回答 :( 以下是更改後的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
文章代碼(AID): #19IXugL_ (MacDev)
文章代碼(AID): #19IXugL_ (MacDev)