remove all subLayers from a view

前端 未结 9 918
春和景丽
春和景丽 2021-02-01 01:16

In an animation I added a lot of sublayers to a view, with:

[self.view.layer addSublayer:layer1];
[self.view.layer addSublayer:         


        
9条回答
  •  无人及你
    2021-02-01 01:36

    This worked for me and fixed the crash:

    [self.view.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)]
    

    I changed the view with my image UImageview, and the crash is gone.

提交回复
热议问题