How to redraw a view in slow-motion
How to redraw a view in slow-motion
- Subject: How to redraw a view in slow-motion
- From: Matthias Arndt <email@hidden>
- Date: Sun, 19 Jun 2011 14:46:59 +0200
In a document-based app my custom view draws some thousand paths in drawRect: with a good performance. Now I'd like to offer a "slow-motion" animation, so the user can actually watch the paths being drawn (not each single one, but e. g. in steps of 100 paths per sec).
I though of several approaches and all of them seem to be infeasible:
1. Sleeping the drawing loop in drawRect: (or make the runLoop wait for some time) and use [... flushGraphics]: Freezes the GUI, as the app is single-threaded
2. Moving the drawing in a 2nd thread and then pause this one: AFAIK is drawing in a second thread not allowed in Cocoa
3. Limit the drawing loop to an increasing high bound, and setup a timer to fire [self setNeedsDisplay:YES] periodically: Causes the first x paths being redrawn at each animation step, resulting in a bad performance
4. Same approach, but skipping the first x paths in the next animation step: Corrupted display, e. g. while resizing in an animation
I'm racking my brains over this, any suggestions?
Mattes _______________________________________________
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