title: CAEmitterLayer emits random unwanted particles on touch events
body: <p>I'm trying to set up a <code>CAEmitterLayer</code> to make a confetti effect, and I've run into two issues: </p>
  
  <ol>
  <li>Whenever I set the <code>birthRate</code> on my cells to something non-zero to start the animation I get a flurry of cells placed randomly on screen, which animate normally, and then the emitter continues to emit properly after that.</li>
  <li>Whenever the <code>emitterCells</code> are drawing things on screen, any time I touch the screen, the emitter draws <code>emitterCells</code> in (seemingly) random locations that exist for a (seemingly) random amount of time. Nothing in the emitter is tied to any touch events (i.e. I'm not intentionally drawing anything on a touch event), but the layer is in a view that has multiple embedded views. The more I touch, the more cells show up.</li>
  </ol>
  
  <p>Here's my code for setting up the emitter, and then starting and stopping it (once I've called the stop function, then taps on the screen cease creating new random elements):</p>
  
  <pre><code>- (void)setupConfetti
  {
      self.confettiLayer = [CAEmitterLayer layer];
      [self.view.layer addSublayer:self.confettiLayer];
      [self.view.layer setNeedsDisplay];
  
      self.confettiLayer.emitterPosition = CGPointMake(1024.0/2,-50.0);
      self.confettiLayer.emitterSize = CGSizeMake(1000.0, 10.0);
      self.confettiLayer.emitterShape = kCAEmitterLayerLine; 
      self.confettiLayer.renderMode =kCAEmitterLayerUnordered;
  
      CAEmitterCell *confetti = [CAEmitterCell emitterCell];
  
      confetti1.contents =  (id)[[UIImage imageNamed:@"confetti.png"] CGImage];
  
      confetti.emissionLongitude = M_PI;
      confetti.emissionLatitude = 0;
      confetti.lifetime = 5;
      confetti.birthRate = 0.0;
      confetti.velocity = 125;
      confetti.velocityRange = 50;
      confetti.yAcceleration = 50;
      confetti.spin = 0.0;
      confetti.spinRange = 10;
      confetti.name = @"confetti1";
  
      self.confettiLayer.emitterCells = [NSArray arrayWithObjects:confetti, nil];
  }
  </code></pre>
  
  <p>To start the confetti:</p>
  
  <pre><code>- (void)startConfettiAnimation
  {
      [self.confettiLayer setValue:[NSNumber numberWithInt:10.0] forKeyPath:@"emitterCells.confetti.birthRate"];
  }
  </code></pre>
  
  <p>And to stop it:</p>
  
  <pre><code>- (void)stopConfettiAnimation
  {
      [self.confettiLayer setValue:[NSNumber numberWithInt:0.0] forKeyPath:@"emitterCells.confetti.birthRate"];
  }
  </code></pre>
  
  <p>Again, once it gets started, after the initial flurry of random elements, this works just fine: everything animates normally, and when the birthRate is later set to zero, it ends gracefully.  It just seems to respond to touch events, and I have no idea why. I've tried adding the emitterLayer to a different view, disabling user interaction on that view, and then adding it as a subview of the main view, and that didn't seem to work. </p>
  
  <p>Any help/insight would be much appreciated!</p>
  
  <p>Thanks,
  Sam</p>