开发者

GtkFileChooserDialog in Cocoa

开发者 https://www.devze.com 2023-01-19 12:46 出处:网络
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.

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

精彩评论

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

关注公众号