<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextAttachmentCellProtocol/highlight(_:withFrame:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextAttachmentCell(im)highlight:withFrame:inView:"
  },
  "title" : "highlight(_:withFrame:in:)"
}
-->

# highlight(_:withFrame:in:)

Draws the receiver’s image with optional highlighting.

```
@MainActor func highlight(_ flag: Bool, withFrame cellFrame: NSRect, in controlView: NSView?)
```

## Parameters

`flag`

A Boolean value that indicates whether to highlight the image. Add a highlight if the value is <doc://com.apple.documentation/documentation/Swift/true>.

`cellFrame`

The frame rectangle in which to draw.

`controlView`

The view in which to draw.

## See Also

[`highlight(_:withFrame:in:)`](/documentation/AppKit/NSCell/highlight(_:withFrame:in:))

Redraws the receiver with the specified highlight setting.

[`lockFocus()`](/documentation/AppKit/NSView/lockFocus())

Locks the focus on the view, so subsequent commands take effect in the view’s window and coordinate system.



---

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)