开发者

GtkFileChooserDialog in Cocoa

I justa want to know if there's a class like GtkFileChooserDialog in Cocoa. This class is used in gtk for 开发者_运维百科opening a file.


Yes there is, NSOpenPanel.

NSOpenPanel *panel = [NSOpenPanel openPanel];
int result = [panel runModal];
if (result == NSOKButton) {
    NSArray *allSelectedFiles = [panel URLs];
    NSURL *selectedFileURL = [allSelectedFiles objectAtIndex:0];
    NSLog(@"Selected: %@", selectedFileURL);
}

NSOpenPanel Class Reference

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜