Please use this
for (CALayer *layer in _plusButton.layer.sublayers) {
if (layer.class == [CAEmitterLayer class]) {
[layer removeFromSuperlayer];
}
}
and please find the link that is helpful for you here
题
I'm playing with particle system in iOS using CAEmitterLayer (like in this example) but i can't remove the particles when i want.
I'm trying the following code but it doesn't work:
[self.emitterLayer setLifetime:0];
[self.emitterLayer removeFromSuperlayer];
[self.setEmitterLayer:nil];
Any suggestions? Thanks!
解决方案
Please use this
for (CALayer *layer in _plusButton.layer.sublayers) {
if (layer.class == [CAEmitterLayer class]) {
[layer removeFromSuperlayer];
}
}
and please find the link that is helpful for you here
其他提示
I have played around with views a lot in the last months esp. with ios 5.0 to 6.0 and my experience is that you can't remove most these views with "removeFrom" but you can hide them and show then at will. Especially if your logic takes place within one view or without a root view.
You only have to implement something like this: to hide it: [YourView setHidden:YES];
or to show it: [YourView setHidden:NO];
Hope this helps,
R.