• 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
Dealing with exceptions in a drawing stack
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dealing with exceptions in a drawing stack


  • Subject: Dealing with exceptions in a drawing stack
  • From: Graham Cox <email@hidden>
  • Date: Thu, 15 Jan 2009 15:34:34 +1100

Suppose I have a drawing stack that is called from a view's drawRect: method. This stack can end up quite deep, with objects calling other objects to implement parts of their drawing. Some of these methods will save and restore the graphics context.

If an exception is thrown from somewhere down inside this stack, I'd prefer it if I could continue to draw what can be drawn, rather than have to abort the drawing altogether which usually leaves the whole view in a weird state (at which point I'm hosed - I have to abandon that document and create a new one, which is hardly user friendly).

Short of using try/catch around every place where the graphics context is saved and restored, is there a way to unwind the graphics context stack or at least put it into a good known state? (i.e. discard all the saved states and start over). If so, I can then implement a try/ catch at a higher level and fix up the graphics context there.

Anyone had some experience of handling this?

--Graham


_______________________________________________

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: Dealing with exceptions in a drawing stack
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: drag and drop with "snapping"
  • Next by Date: Re: Dealing with exceptions in a drawing stack
  • Previous by thread: Re: drag and drop with "snapping"
  • Next by thread: Re: Dealing with exceptions in a drawing stack
  • Index(es):
    • Date
    • Thread