---
title: "runModalForTypes:"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsopenpanel/runmodalfortypes:"
---

# runModalForTypes:

Displays the panel and begins a modal event loop that is terminated when the user clicks either OK or Cancel.

## Declaration

```occ
- (NSInteger) runModalForTypes:(NSArray *) fileTypes;
```

## Parameters

- `fileTypes`: An array of file extensions and/or HFS file types. Specifies the files the panel allows the user to select. nil makes all files selectable by the user. An array of types passed in here will override one set using doc://com.apple.appkit/documentation/AppKit/NSSavePanel/allowedFileTypes.

## Return Value

Return Value The button used to dismiss the dialog: NSOKButton for the OK button and NSCancelButton for the Cancel button.

## Discussion

Discussion This convenience method sends runModalForDirectory:nil file:nil types:``fileTypes to the panel. See runModalForDirectory:file:types: for additional details.

## See Also

### Related Documentation

- [runModal()](appkit/nssavepanel/runmodal().md)

### Methods

- [filenames](appkit/nsopenpanel/filenames.md)
- [beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:](appkit/nsopenpanel/beginfordirectory:file:types:modelessdelegate:didendselector:contextinfo:.md)
- [beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:](appkit/nsopenpanel/beginsheetfordirectory:file:types:modalforwindow:modaldelegate:didendselector:contextinfo:.md)
- [runModalForDirectory:file:types:](appkit/nsopenpanel/runmodalfordirectory:file:types:.md)
