drawRect: called twice for NSView subclass.
drawRect: called twice for NSView subclass.
- Subject: drawRect: called twice for NSView subclass.
- From: William Hunt <email@hidden>
- Date: Sat, 19 Apr 2008 17:15:11 -0700
Ok, it's been a while since I've bugged you guys, so I thought I'd get
back into the fold. Note that I'm very new to graphics programming in
general, and even more so for Cocoa. So be prepared for an easy fix!
Anyway, the problem I have is this.
+------------------+
|+----------------+|
|| Custom ||
|| View ||
|+----------------+|
| == |
+------------------+
(The graphic looks a little better if you switch to a fixed pitch
font..)
Essentially I have a window with a custom view atop a button. What
happens at each refresh, however, is that the custom view's drawRect:
is called twice. First it is called with the whole window's NSRect,
then it is called with the "proper" NSRect. The result is that if I
draw a circle at (0,0), it gets drawn twice at different locations:
+------------------+
|+----------------+|
|| Custom ||
||o View ||
|+----------------+|
|o == |
+------------------+
What is going on here? Is this buggy behavior or correct behavior?
My code is basically a new Cocoa application with a single NSView
subclass. There is absolutely nothing funny (that I know of) going on
here. That leads me to believe that the behavior is "correct," and
that I'm just missing something.
For the record, I only want the one call to drawRect:, the one with
the "proper" NSRect.
Ideas?
Wil
--
Wil Hunt
"Life is the art of drawing sufficient conclusions from insufficient
premises."
-- Samuel Butler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden