Re: Text Animation
Re: Text Animation
- Subject: Re: Text Animation
- From: Uli Kusterer <email@hidden>
- Date: Sat, 1 Sep 2007 12:38:04 +0200
On 01.09.2007, at 08:44, Ben Lachman wrote:
Any quick pointers on how to animate a block of text that is
manually drawn in a custom view? I'm drawing the text using -
[NSString drawWithRect:options:attributes:]. I've tried running an
NSAnimation but my drawing in the -animation:didReachProgressMark:
method doesn't seem to ever reach the screen even though I'm
locking/unlocking focus.
There are only a few places where you're ever allowed to draw in
Cocoa: Either between a lockFocus/unlockFocus on an NSImage/
NSImageRep, or from inside the drawRect method of an NSView subclass
(that's pure Cocoa, i.e. AppKit -- if you use OpenGL directly or
CoreImage or so, there may be other places). You're not supposed to
lock focus on a view manually and draw just at any old time. If you
want to use NSAnimation, use an NSView that draws what you want to
draw, and then send it setNeedsDisplay:. -
animation:didReachProgressMark: is supposed to be used to change the
view's properties (e.g. move it, call setNeedsDisplay: etc.), not to
do the actual drawing.
Does that clear up the confusion?
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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