NSSavePanel *fileDialog = [NSSavePanel savePanel];
[fileDialog setAllowedFileTypes:[NSArray arrayWithObject:@"rar"]];//允许保存的文件后缀名 [fileDialog setDirectoryURL:[NSURL fileURLWithPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"]]];//设置默认打开路径 // int result = [fileDialog runModalForDirectory:[NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"] file:nil]; int result = [fileDialog runModal]; if (result == NSOKButton) self.file = [[fileDialog URL] path];//保存文件路径
设置savepanel或openpanel的默认打开路径方法,布布扣,bubuko.com
设置savepanel或openpanel的默认打开路径方法
原文:http://www.cnblogs.com/orientwolf/p/3886928.html