ios - CAGradientLayer Redraw Method -
i've got draw method draws gradient layer:
cagradientlayer *bglayer = [backgroundlayer morninggradient]; bglayer.frame = self.view.bounds; [self.view.layer insertsublayer:bglayer atindex:[self.view.layer.sublayers count]];
but know it's inserting sublayer every time it's called lead memory problems down line , since fit screen there's no reason not deleting them before add in new one.
how can this, i've tried using:
[self.view.layer removefromsuperlayer];
but lldb error (probably because first time it's called there no sublayer remove)
[self.view.layer removefromsuperlayer];
wrong layer! layer added not self.view.layer
. self.view.layer.sublayers[i]
i
integer (zero or larger).
i not understand why inserting multiple sublayers that, have reason, won't try grapple issue. anyway, answers crash problem. have figure out of many sublayers want remove, , remove it.
Comments
Post a Comment