<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCustomImageRep/init(draw:delegate:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCustomImageRep(im)initWithDrawSelector:delegate:"
  },
  "title" : "init(draw:delegate:)"
}
-->

# init(draw:delegate:)

Returns a representation of an image initialized with the specified delegate information.

```
init(draw selector: Selector, delegate: Any)
```

## Parameters

`selector`

The selector to call when it is time to draw the image. The method should take a single parameter of type `id` that represents the [`NSCustomImageRep`](/documentation/AppKit/NSCustomImageRep) object that initiated drawing. The method must draw the image starting at the point (0, 0) in the current coordinate system.

`delegate`

The delegate object that responds to the selector in `aMethod`.

## Return Value

An initialized [`NSCustomImageRep`](/documentation/AppKit/NSCustomImageRep) object, or `nil` if the object could not be initialized.

## Discussion

When the receiver is asked to draw the image, it sends the specified message to the selector, passing itself as a parameter to the delegate method. The delegate’s drawing method should have the following form:

```objc
- (void)myCustomDrawMethod:(id)anNSCustomImageRep;
```

## See Also

[`-  draw`](/documentation/AppKit/NSImageRep/draw())

Implemented by subclasses to draw the image in the current 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)