On May 1, 2009, at 5:20 AM, DairyKnight wrote:

I'm trying to build a simple scribble program with Cocoa, and got some
questions I couldn't solve. Hope someone here could help.

   1. How can I perform a proper drawing in somewhere else rather than
drawRect: ? Like the Win32 GetDC(HWND) and ReleaseDC. (Sorry I'd use lots of
Win32 analogy, coz
I've been a Win32 developer for quite a while.)

Create an ivar context, draw your stuff in there. Then call setNeedsDisplay on the view and draw the contents of the context in drawRect.

Even in Win32 you are supposed to do the drawing only in WM_PAINT, not just anytime you want.


Alex Kac - President and Founder
Web Information Solutions, Inc.

"If at first you don't succeed, skydiving is not for you."
-- Francis Roberts





_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to