<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSOpenPanel/runModalForTypes:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSOpenPanel(im)runModalForTypes:"
  },
  "title" : "runModalForTypes:"
}
-->

# runModalForTypes:

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

```
- (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 [`allowedFileTypes`](/documentation/AppKit/NSSavePanel/allowedFileTypes).

## Return Value

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

## Discussion

This convenience method sends `runModalForDirectory:nil file:nil types:``fileTypes` to the panel. See [`runModalForDirectory:file:types:`](/documentation/AppKit/NSOpenPanel/runModalForDirectory:file:types:) for additional details.

## See Also

[`func runModal() -> NSApplication.ModalResponse`](/documentation/AppKit/NSSavePanel/runModal())

Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)