0

I am drawing some rectangles directly on the main window using NSBezierPath. The drawing code is triggered by a button on the main window. If I click on the button, the drawing code happens, but the drawing does not show on the window. On the other hand, if I press the button's shortcut key, the drawing does show on the window. I have done a lot of trial and error with methods that cause a window or view to refresh, and the same behavior persists. Any thoughts? Many thanks.

wagill
  • 57
  • 6
  • 1
    It sounds like you are "fighting the framework". Normally, you draw when Cocoa asks you to, e.g., in a `drawRect:` method of an `NSView` subclass. If I've misunderstood, you should show some code. – JWWalker Sep 10 '15 at 00:03
  • You are absolutely right. Now I realize that I should do just that: add a custom view to my main window, and do all my drawing in that view's `-drawRect:`. Thanks so much. – wagill Sep 10 '15 at 04:52

0 Answers0