<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPImageOverlay",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPImageOverlay"
  },
  "title" : "CPImageOverlay"
}
-->

# CPImageOverlay

An overlay that displays information over an image.

```
@MainActor class CPImageOverlay
```

## Topics

### Initializers

[`init?(coder: NSCoder)`](/documentation/CarPlay/CPImageOverlay/init(coder:))

[`init(image: UIImage, alignment: CPImageOverlay.Alignment)`](/documentation/CarPlay/CPImageOverlay/init(image:alignment:))

Initialize an overlay with a UIImage.

[`init(text: String, textColor: UIColor, backgroundColor: UIColor, alignment: CPImageOverlay.Alignment)`](/documentation/CarPlay/CPImageOverlay/init(text:textColor:backgroundColor:alignment:))

Initialize an overlay with properties that control the overlay’s appearance and text contents.

### Instance Properties

[`var alignment: CPImageOverlay.Alignment`](/documentation/CarPlay/CPImageOverlay/alignment-swift.property)

The alignment for positioning the overlay.

[`var backgroundColor: UIColor?`](/documentation/CarPlay/CPImageOverlay/backgroundColor)

The background color of the overlay.

[`var image: UIImage?`](/documentation/CarPlay/CPImageOverlay/image)

An optional image to display in the overlay.

[`var text: String?`](/documentation/CarPlay/CPImageOverlay/text)

The text displayed in the overlay.

[`var textColor: UIColor?`](/documentation/CarPlay/CPImageOverlay/textColor)

The color of the overlay text.

### Enumerations

[`enum Alignment`](/documentation/CarPlay/CPImageOverlay/Alignment-swift.enum)

Alignment options for positioning.

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)