Re: Drawing in a view from a controller
Re: Drawing in a view from a controller
- Subject: Re: Drawing in a view from a controller
- From: Shawn Erickson <email@hidden>
- Date: Tue, 4 Nov 2003 08:43:43 -0800
On Nov 4, 2003, at 6:03 AM, Robert Borsuk wrote:
Hi,
I know this question has been asked before but I've spent several
hours trying to find the answer in archives and I can't seem to locate
it. Okay, here's the question.
If I draw into a view from my controller using lockFocus how do I get
the view to stay (to know that it was drawn into)? I'm not drawing
using drawRect (non-subclassed NSView)(is that a word?).
I would appreciate if someone could even point me to archive that had
this question before.
You really should not be attempting to do things this way for a few
reasons (if I understand what you are saying). 1) A controller should
not be _directly_ involved in drawing, leave that to your views. 2) You
should be drawing in the drawRect pathway since when it is called the
drawing environment is setup correctly for you (clipping, etc.). Doing
things outside of that can result in strange behavior if done wrong.
You can draw into NSImage by locking focus on the image and doing your
drawing then blit that image as needed in a drawRect.
Hard to best answer your question given what you have said so far...
what is the view you are drawing in, what are you trying to do, is this
window/panel loaded from a nib, etc.?
It should be as simple as defining a custom view in your nib and making
a simple NSView subclass that implement the drawing code needed in
drawRect.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.