CAGradientLayer bounds not changing

戏子无情 提交于 2019-12-02 20:02:57

问题


I have a CAGradientLayer which is added to a UIVIew, when I rotate the device the view that it is added to increases in size (with autolayout) however the CA layer doesn't change its size.

I have tried implementing the viewDidLayoutSubviews method and setting the layers frame in there but it doesn't make any difference.

Once the device is rotated if I navigate away from the view and then back to it then the layer gets drawn correctly.


回答1:


You could override - (void)layoutSubviews in your UIView subclass and then update the layers frame.



来源:https://stackoverflow.com/questions/33414131/cagradientlayer-bounds-not-changing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!