Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement +(Class) layerClass in Xamarin.iOS?

I see this in many projects that demonstrate the use of CAEmitterLayer, but how does it translate to MonoTouch aka Xamarin.iOS?

+ (Class) layerClass 
{
    //configure the UIView to have emitter layer
    return [CAEmitterLayer class];
}

I know I can use UIView.Layer.AddSubLayer() but there seems to be performance impact.

like image 326
Krumelur Avatar asked May 27 '13 20:05

Krumelur


1 Answers

I think you need to expose it to Obj runtime like the following.

[Export ("layerClass")]
public static Class LayerClass () {
  return new Class (typeof (CAEmitterLayer));
}

For further info take a look to MonoTouch... CATiledLayer example.

Hope it helps.

P.S. Check the code. I've written without Xamarin Studio support.

like image 142
Lorenzo B Avatar answered Nov 05 '22 00:11

Lorenzo B