可可 – 如何在NSOpenPanel中将“打开”更改为“选择”?

可可 – 如何在NSOpenPanel中将“打开”更改为“选择”?,第1张

概述在我的应用程序中,我需要显示选择文件对话框, 我正在使用NSOpenPanel,它允许选择文件,代码如下所示, - (IBAction)sendFileButtonAction:(id)sender{ NSOpenPanel* openDlg = [NSOpenPanel openPanel]; // Enable the selection of files in the d 在我的应用程序中,我需要显示选择文件对话框,
我正在使用NSOpenPanel,它允许选择文件,代码如下所示,

- (IBAction)sendfilebuttonAction:(ID)sender{    NSOpenPanel* openDlg = [NSOpenPanel openPanel];    // Enable the selection of files in the dialog.    [openDlg setCanChoosefiles:YES];    // Enable the selection of directorIEs in the dialog.    [openDlg setCanChooseDirectorIEs:YES];    // display the dialog.  If the OK button was pressed,// process the files.    if ( [openDlg runModalForDirectory:nil file:nil] == NSOKbutton )    {        // Get an array containing the full filenames of all        // files and directorIEs selected.        NSArray* files = [openDlg filenames];        // Loop through all the files and process them.        for( int i = 0; i < [files count]; i++ )        {            Nsstring* filename = [files objectAtIndex:i];            [self log:filename];            // Do something with the filename.        }    }}

一切都很完美,但我只面对一个问题,打开文件时会显示“打开”和“取消”按钮,
有没有办法将打开的按钮重命名为“选择”按钮,或者我需要使用其他可可资源。

解决方法 添加这一行:

[openDlg setPrompt:@"Select"];
总结

以上是内存溢出为你收集整理的可可 – 如何在NSOpenPanel中将“打开”更改为“选择”?全部内容,希望文章能够帮你解决可可 – 如何在NSOpenPanel中将“打开”更改为“选择”?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1040836.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存