Re: Discard all drawing in a UIView

2010-07-25 Thread Malayil George
Well...the occurrence of this particular scenario is very rare. It might be expensive, but, has not had any effects on program performance so far. I am not in control of the ranges supplied and yes, I could always check if the range is valid before extracting the substring. However, if the

Re: Discard all drawing in a UIView

2010-07-25 Thread Manfred Schwind
But, the question still does remain, even if purely for academic reasons - can we clear a UIView (in a custom UITableViewCell) in the drawRect routine after beginning to draw in it. I have tried playing around with two options so far 1. CGContextClearRect() - This however clears to a black

Re: Discard all drawing in a UIView

2010-07-24 Thread Steve Christensen
I personally wouldn't use exceptions to handle what are basically known coding bugs, e.g., choosing not to add an extra line or two of code to do range checking when you know ahead of time that there are strings that you don't consider valid. And whether or not you continue using your current

Re: Discard all drawing in a UIView

2010-07-24 Thread Graham Cox
On 25/07/2010, at 6:47 AM, Steve Christensen wrote: I am extracting strings from an NSString and I get NSRange exceptions. I could always first check to see if the range is valid, but, figured I would save myself the effort and use the exception handling mechanism. NO, this is misguided.

Re: Discard all drawing in a UIView

2010-07-22 Thread Steve Christensen
I think a more basic question is what you're doing in -drawRect that would generate an exception in the first place. Typically a view should already have access to any relevant resources (strings, images, whatever) before -drawRect is ever called. Assuming that the exception is a reasonable

Discard all drawing in a UIView

2010-07-21 Thread Malayil George
Hi, I am trying to draw to a custom UITableViewCell. The UITableViewCell has a UIView and I do some custom drawing in it's drawRect. However, in some cases while doing the drawing I run into an exception. I catch the exception and at this point, want to clear all existing drawing in the view