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

 

 

posted on 2012-11-22 22:33  老Zhan  阅读(2150)  评论(0编辑  收藏  举报