iOS:解决动画加阴影卡的问题

    self.root.view.layer.shadowColor = [UIColor blueColor].CGColor;
    self.root.view.layer.shadowOpacity = 0.4f;
    self.root.view.layer.shadowOffset = CGSizeMake(-12.0, 1.0f);
    self.root.view.layer.shadowRadius = 7.0f;
    self.root.view.layer.masksToBounds = NO;

用上面代码对有动画的view加了阴影,会有卡顿的现象。

要设置一下path:

[UIBezierPath bezierPathWithRect:_toView.bounds].CGPath;

    self.root.view.layer.shadowPath =[UIBezierPath bezierPathWithRect:self.root.view.bounds].CGPath;
    self.root.view.layer.shadowColor = [UIColor blueColor].CGColor;
    self.root.view.layer.shadowOpacity = 0.4f;
    self.root.view.layer.shadowOffset = CGSizeMake(-12.0, 1.0f);
    self.root.view.layer.shadowRadius = 7.0f;
    self.root.view.layer.masksToBounds = NO;

卡顿消失。

check:http://blog.csdn.net/mkhgg/article/details/7286282

 

   


作者:老Zhan
出处:http://www.cnblogs.com/mybkn/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

 
原文地址:https://www.cnblogs.com/mybkn/p/2783438.html