使用文件弹窗进行文件选择
来源:互联网 发布:发票打印软件 编辑:程序博客网 时间:2024/06/03 17:12
NSOpenPanel *openDlg = [NSOpenPanelopenPanel];
[openDlg setCanChooseFiles:YES];
[openDlg setCanChooseDirectories:YES];
[openDlg setPrompt:@"Select"];
if([openDlgrunModalForDirectory:@"/AppleInternal/Applications"file:@"myAppName.app"] ==NSOKButton)
{
NSArray *files = [openDlgfilenames];
for(int i =0; i < [filescount]; i++){
NSString *fileName = [filesobjectAtIndex:i];
NSLog(@"Select File Name : %@",fileName);
[pathControl setURL:[NSURLfileURLWithPath:fileName]]; //NSPathControl *pathControl
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NSOpenPanel *op = [NSOpenPanelopenPanel];
[op setCanChooseFiles:YES];
[op setCanChooseDirectories:YES];
[op beginSheetForDirectory: [[pathSelectURL]path]
file: nil
types:nil
modalForWindow: [selfwindow]
modalDelegate:self
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
contextInfo: nil
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- (void) openPanelDidEnd:(NSOpenPanel *)op
returnCode:(int)returnCode
contextInfo:(void *)ci
{
if (returnCode ==NSOKButton) {
//NSString* path = [op filename];
NSArray *files = [opfilenames];
for(int i =0; i < [files count]; i++){
NSString *fileName = [filesobjectAtIndex:i];
NSLog(@"Selsct File Name : %@",fileName);
[pathSelectsetURL:[NSURLfileURLWithPath:fileName]];
}
}
}
- 使用文件弹窗进行文件选择
- 使用OpenFileDialog选择文件
- 使用文件进行优化
- 打开文件对话框能进行多项选择
- input 选择文件进行格式限制
- js选择文件进行导入(FileSaver.js)
- 路径选择框&文件选择框使用
- VS2010 使用 CFileDialog 选择文件
- Android 文件选择的使用
- 使用java进行文件加密
- 使用CSockets进行文件传送
- 使用IRP进行文件操作
- 使用IRP进行文件操作
- 使用Struts进行文件上传
- 使用IRP进行文件操作
- 使用NIO进行文件操作
- 使用数据流进行文件下载
- android使用文件进行存储
- Spark源码系列(二)RDD详解
- source insight的快捷键总结
- PDF文件字体嵌入
- c++计算程序运行时间
- 10个用于开发人员的Linux发行版
- 使用文件弹窗进行文件选择
- Minimum Path Sum
- 深度学习最全优化方法总结比较(SGD,Adagrad,Adadelta,Adam,Adamax,Nadam)
- tomcat8.5.15源码编译运行
- 技术之路心得随记
- source insight和vim同时使用
- Oracle数据库多重子查询嵌套的坑
- 怎么学JavaScript?
- 关于e.fillInStackTrace()的理解