When I first set up the emitter I can do this:
self.cell = [CAEmitterCell emitterCell];
self.cell.yAcceleration = 20;
...
self.emitter.emitterCells = [NSArray arrayWithObjects:self.cell,nil];
But say I create a timer that fires 5 seconds later, and I do this:
- (void)timerFired
{
self.cell.yAcceleration = -10;
}
The timer fires, but the yAcceleration of the CAEmitterCell does not get changed. Or at least nothing changes in the particle emission on screen. How can I get a CAEmitterCell to respect changes I make to its properties?
This is not real obvious, but here's the solution:
[self.emitter setValue:[NSNumber numberWithFloat:-10.0]
forKeyPath:@"emitterCells.cell.yAcceleration"];
Where "cell" is the name given here:
[self.cell setName:@"cell"];