• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to redraw a view in slow-motion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to redraw a view in slow-motion
      • From: Uli Kusterer <email@hidden>
    • Re: How to redraw a view in slow-motion
      • From: Graham Cox <email@hidden>
    • Re: How to redraw a view in slow-motion
      • From: Ken Tozier <email@hidden>
  • Prev by Date: Re: Setting the firstResponder in a view
  • Next by Date: Re: making a clickable link in NSTableView
  • Previous by thread: Re: making a clickable link in NSTableView
  • Next by thread: Re: How to redraw a view in slow-motion
  • Index(es):
    • Date
    • Thread