• 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
Re: Discard all drawing in a UIView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Discard all drawing in a UIView


  • Subject: Re: Discard all drawing in a UIView
  • From: Malayil George <email@hidden>
  • Date: Sun, 25 Jul 2010 12:36:33 -0400

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 programmer
is expected to do this, then the existence of NSRangeException (and having
substringWithRange: method throw it), seems to be moot (imho) :-)
I might very well end up doing these checks outside the drawRect: routine
and code up drawRect to have different flows based on the results of those
checks. 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 box and I am not
able to get it to clear transparently. Setting isOpaque:NO on the view in
the nib doesn't seem to have an effect.
2. Fill with white and then draw. This displays ok when then view is not
selected. When it is selected, however, it results in blue color surrouding
the view (with the view remaining white). Filling with blueColor in the
selected state, doesn't seem to work well either. The blue color is a solid
blue, while the selection blue surrounding it seems to be some sort of
gradient


Thanks
George


On Sun, Jul 25, 2010 at 1:07 AM, Graham Cox <email@hidden> wrote:

>
> 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.
>
> Exceptions are meant to indicate a PROGRAMMER error, not a routine runtime
> situation (clue, they are called exceptions, and so indicate truly
> exceptional circumstances, not just an edge case you couldn't be bothered to
> check for). They are expensive, and should not be used for flow control,
> especially as there is a very simple way to avoid them in this case. If you
> can avoid using exceptions, always do so.
>
> --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: Discard all drawing in a UIView
      • From: Manfred Schwind <email@hidden>
References: 
 >Discard all drawing in a UIView (From: Malayil George <email@hidden>)
 >Re: Discard all drawing in a UIView (From: Steve Christensen <email@hidden>)
 >Re: Discard all drawing in a UIView (From: Steve Christensen <email@hidden>)
 >Re: Discard all drawing in a UIView (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Deselect keyboard focus of an NSMatrix cell
  • Next by Date: NSStatusItemthreading
  • Previous by thread: Re: Discard all drawing in a UIView
  • Next by thread: Re: Discard all drawing in a UIView
  • Index(es):
    • Date
    • Thread