Is the host calling you at the time when it wants you to draw into the view? Do you know if it's calling you from within the view's -drawRect: method?That's usually how/when a custom view draws. It can be marked as needing display and then Cocoa, at a time it deems appropriate, calls the view's -drawRect: method. Before doing this, Cocoa will have set up the thread's implicit current drawing context to draw into the view with the appopriate coordinate system, etc. (It has called -lockFocus on the view.) At that point you just issue Cocoa or Core Graphics drawing operations and they draw to the view.So, if your host has called you inside of the view's -drawRect: method, you can just do: [pImage drawAtPoint:NSMakePoint(whateverX, whateverY) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];You can use different parameters than what I wrote or use one of the other drawing methods on NSImage to achieve different effects.If the host is calling you inside -drawRect:, then you definitely should not set
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: