FROM : Scott Thompson
DATE : Sun Apr 20 03:28:53 2008
On Apr 19, 2008, at 7:15 PM, William Hunt wrote:
> 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.
It sounds like you've somehow ended up with the content rect of the
window as an instance of your custom view class.
How do you create your view hierarchy (i.e. in Interface Builder) or
"by hand"?
Scott
DATE : Sun Apr 20 03:28:53 2008
On Apr 19, 2008, at 7:15 PM, William Hunt wrote:
> 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.
It sounds like you've somehow ended up with the content rect of the
window as an instance of your custom view class.
How do you create your view hierarchy (i.e. in Interface Builder) or
"by hand"?
Scott
| Related mails | Author | Date |
|---|---|---|
| William Hunt | Apr 20, 02:15 | |
| Scott Thompson | Apr 20, 03:28 | |
| David Duncan | Apr 20, 20:13 | |
| William Hunt | Apr 20, 22:49 |






Cocoa mail archive

