<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCell/edit(withFrame:in:editor:delegate:event:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCell(im)editWithFrame:inView:editor:delegate:event:"
  },
  "title" : "edit(withFrame:in:editor:delegate:event:)"
}
-->

# edit(withFrame:in:editor:delegate:event:)

Begins editing of the receiver’s text using the specified field editor.

```
func edit(withFrame rect: NSRect, in controlView: NSView, editor textObj: NSText, delegate: Any?, event: NSEvent?)
```

## Parameters

`rect`

The bounding rectangle of the cell.

`controlView`

The control that manages the cell.

`textObj`

The field editor to use for editing the cell.

`delegate`

The object to use as a delegate for the field editor (`textObj` parameter). This delegate object receives various `NSText` delegation and notification methods during the course of editing the cell’s contents.

`event`

The `NSLeftMouseDown` event that initiated the editing behavior.

## Discussion

If the receiver isn’t a text-type `NSCell` object, no editing is performed. Otherwise, the field editor (`textObj`) is sized to `aRect` and its superview is set to `controlView`, so it exactly covers the receiver. The field editor is then activated and editing begins. It’s the responsibility of the delegate to end editing when responding to [`textShouldEndEditing(_:)`](/documentation/AppKit/NSTextDelegate/textShouldEndEditing(_:)). Upon ending the editing session, the delegate should remove any data from the field editor.

---

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)