Thanks for a detailed explanation 2011/5/11 Ken Thomases <k...@codeweavers.com>: > On May 10, 2011, at 11:26 AM, Nick wrote: > >> Can someone explain please, when an NSView's call -drawRect >> (being called manually - not by a framework) actually initiates >> redrawing of the frame and displaying everything that it had drawn, >> and when this call "doesn't initiate a thing"? > > When the framework calls your -drawRect: method, it has already established a > graphics context and configured it as appropriate for the view. If you just > call it yourself, there's either no current graphics context or some > arbitrary graphics context that isn't related to your view. > > It's conceivable that one could manually set up the graphics context and then > call -drawRect: oneself, but it's going to be complicated and error-prone. > It is not advised > > Search the documentation for the -lockFocus... methods of NSView -- not just > the class reference, but also the mentions of it in the View Programming > Guide (the Advanced Custom View Tasks page) and the Threading Programming > Guide (the Thread Safety Summary page). That latter is especially important > since you're working with a display link, which calls your callback on a > secondary thread. It couldn't hurt to read about graphics contexts in the > Quartz 2D Programming Guide and Cocoa Drawing Guide. > > All of that said, you should always think twice about fighting the > frameworks, as has been said by others. Chances are you're doing something > you shouldn't be or are making your life harder for no good reason. > > Regards, > Ken > > _______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com