en mi solicitud que necesito para mostrar el cuadro de diálogo de selección de archivos, estoy haciendo uso de la NSOpenPanel que permite seleccionar el archivo, el código es como se muestra a continuación,¿Cómo cambio "Abrir" a "Seleccionar" en el 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.
}
}
}
todo funciona perfecto, pero estoy frente solo un problema, al abrir el archivo, muestra el botón Abrir y cancelar, ¿Hay alguna manera de cambiar el nombre del botón de abrir al botón "Seleccionar", o necesito usar algún otro recurso de cacao.
Por cierto, la propiedad nombres de archivo se declara en desuso en OS X 10.6 –
runModalForDirectory: file: tipos: está en desuso en OS X v10.6. Podría usar runModal en su lugar. Puede establecer la ruta usando setDirectoryURL :, y puede establecer fileTypes usando setAllowedFileTypes :. – Itachi