<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextViewDelegate/textView(_:editMenuForTextInRanges:suggestedActions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextViewDelegate(im)textView:editMenuForTextInRanges:suggestedActions:"
  },
  "title" : "textView(_:editMenuForTextInRanges:suggestedActions:)"
}
-->

# textView(_:editMenuForTextInRanges:suggestedActions:)

```
optional func textView(_ textView: UITextView, editMenuForTextInRanges ranges: [NSValue], suggestedActions: [UIMenuElement]) -> UIMenu?
```

## Parameters

`textView`

The text view requesting the menu.

`ranges`

The text ranges for which the menu is presented for.

`suggestedActions`

The actions and commands that the system suggests.

## Return Value

Return a UIMenu describing the desired menu hierarchy. Return @c nil to present the default system menu.

## Discussion\abstract Asks the delegate for the menu to be shown for the specified text ranges.
\discussion If the delegate does not implement this method then the `textView:editMenuForTextInRange:suggestedActions:` method will be called and passed the union range instead. If the delegate also does not implement that method then `nil` is assumed.

---

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)