NSOpenPanel - 一切已弃用? [英] NSOpenPanel - Everything deprecated?

查看:303
本文介绍了NSOpenPanel - 一切已弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图找到一个窗口显示要求该人选择一个文件,我最终做到了。问题是,Xcode抱怨我使用的方法已被弃用。我查看了类别参考,但在正在运行的面板部分下的所有内容已被弃用,因为Mac OS 10.6。是否有不同的类,我应该使用现在?

I've been trying to get a window to show up asking the person to choose a file, and I eventually did. The problem is, Xcode complains that the method I'm using is deprecated. I looked in the class reference, but everything under the "running panels" section has been deprecated as of Mac OS 10.6. Is there a different class I'm supposed to be using now?

推荐答案

据我所知, code> runModal 方法,如下所示:

As far as I know, you can use the runModal method like shown below:

NSOpenPanel *openPanel = [[NSOpenPanel alloc] init];

if ([openPanel runModal] == NSOKButton)
{
    NSString *selectedFileName = [openPanel filename];
}

这篇关于NSOpenPanel - 一切已弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆