Remove the layer from its superLayer iOS objective C
Solution:
Right:
for(int i=0;i<self.layer.sublayers.cou nt;i++) {
CALayer *item = self.layer.sublayers[i];
if([item.name isEqual: @"myLayer"]) {
[item removeFromSuperlayer];
i--;
}
}
Wrong:
for(CALayer *item in self.layer.sublayers) {
if([item.name isEqual: @"myLayer"]) {
[item removeFromSuperlayer];
}
}
Comments
Post a Comment