Question

I'm trying to do a particle effect where I have a cell nested onto another cell. Think of the basic firework example they have here in the Apple Docs. They've nested Cells into other Cells and they've timed them using the BeginTime parameter. I, however, do not have a "beginTime" parameter for my CAEmittorCell like they do, I have one in the CAEmittorLayer instead... How am I supposed to nest cells and have them execute at different times if the cell does not have a beginTime parameter?

Notice in the apple example code they have a "beginTime" parameter for CAEmitterCell

**CAEmitterCell *firework = [CAEmitterCell emitterCell];**
firework.contents = img;
firework.birthRate = 9999;
firework.scale = 0.6;
firework.velocity = 130;
firework.lifetime = 2;
firework.alphaSpeed = -0.2;
firework.yAcceleration = -80;
**firework.beginTime = 1.5;**
firework.duration = 0.1;
firework.emissionRange = 2 * M_PI;
firework.scaleSpeed = -0.1;
firework.spin = 2;

---- Solved, see replies below ----

I simply called the selector manually like this to get the desired result:

CAEmitterCell cell = new CAEmitterCell();
cell.SetValueForKeyPath (NSNumber.FromFloat(1), (NSString)"beginTime");
Was it helpful?

Solution

The CAMediaTiming bindings are not really missing. They were folded into CAAnimation (here) and CALayer (here). That's because, before 7.0's [Protocol] support, is was the way to implement protocols.

The issue is that CAMediaTiming is documented to be adopted by only those two types - but CAEmitterCell (and maybe others, I need to check) also conforms to it and right now do not expose the protocol methods.

The quick/immediate workaround is to call the missing selector on the instance. Future versions of Xamarin.iOS will provide them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top