title: Quartz Drawing While Scrolling Issue
body: <p>I have a subclass of UIView which I draw a graph on it.</p>
  
  <p><strong>GraphingView.h</strong></p>
  
  <pre><code>@interface GraphingView : UIView
  ...
  @end
  </code></pre>
  
  <p>I draw things here:</p>
  
  <p><strong>GraphingView.m</strong></p>
  
  <pre><code>- (void)drawRect:(CGRect)rect
  {
  ...
  }
  </code></pre>
  
  <p>Then, from another controller, I call this graph by just initializing and add that subview</p>
  
  <pre><code>graphView = [[GraphingView alloc] init];
  ...
  [self.view addSubview:graphView];
  </code></pre>
  
  <p>But I actually call this subview multiple times with UIScrollView in different pages. Let's say 3 pages for 3 different graphs. Everything works fine if I just need 3 static graphs. Because of my scroller is infinite, every time I swipe the scroller left or right, the scroller will generate an older or newer graph which sits previous or next to the graph of direction. For that reason, I use <code>scrollViewDidScroll</code> to detect and insert new graph. However, <code>scrollViewDidScroll</code> makes too many calls to the subviews since it has not been stopped. So, that means I am re-drawing too much with Quartz 2D and it causes the app to crash. Does that sounds memory leak of Quartz?</p>
  
  <p>For that matter, I then decided to call the graph subview in <code>scrollViewDidEndDecelerating</code> instead. But after a while scrolling, the app crashes just like above since I still call the subview which has drawRect method too many times.</p>
  
  <p><strong>My question is, how do I prevent this Quartz from crashing because <code>drawRect</code> is being called more than it should be?</strong></p>