Remove the layer from its superLayer iOS objective C

Solution:

Right:

for(int i=0;i<self.layer.sublayers.count;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

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift