3

I'm wondering whether I need to check if something is within the bounds of the CGRect passed to drawRect:, or if drawRect: automatically handles that for me.

For example, assume that I have 10 UIBezierPaths on the screen. Each curve is in an NSMutableArray named curves. Every time drawRect: is called, it loops through this array and draws the curves it finds there. If the use moves one curve, I find its containing CGRect and call [self setNeedsDisplayInRect:containingRect]. In my drawRect: implementation, do I need to personally check whether each of the UIBezierPaths falls within the CGRect passed to drawRect: (using CGRectIntersectsRect), or is that handled automatically?

Mat
  • 202,337
  • 40
  • 393
  • 406
maxedison
  • 17,243
  • 14
  • 67
  • 114

1 Answers1

0

This falls into a class of optimizations you'll have to make yourself if you think it's necessary after profiling.

UIKit isn't that smart unfortunately. Though it would probably be too slow if it was!

David Hodge
  • 1,724
  • 15
  • 13