在视图周围绘制阴影会减慢我的过渡速度 [英] drawing shadow around a view slows down my transition,CALayer,ios
问题描述
MyViewControllerB.xib包含
MyViewControllerB.xib contains
view( UIView )
|
|__image (UIImageView)
|
|__view (UIView)
|
|__text (UITextView)
|
|__view (UIView) ( shadow is adding at here )
然后我要添加一个底部视图周围的阴影如下
Then I am adding a shadow around the view at the bottom as following
- (void)viewDidLoad
{
[super viewDidLoad];
[self.bottomView.layer setMasksToBounds:NO];
self.bottomView.layer.shadowColor = [UIColor blackColor].CGColor;
self.bottomView.layer.shadowRadius = 5;
self.bottomView.layer.shadowOpacity = 1;
self.bottomView.layer.shadowOffset = CGSizeMake(0 , 0 );
}
我在做 pushViewController:动画:
在MyViewControllerA上:
when I am doing pushViewController: animated:
at MyViewControllerA :
@implementation MyViewControllerA
MyViewControllerB *controller = [[MyViewControllerB alloc] initWithNibName:@"MyViewControllerB" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
然后,过渡过程并不十分顺利。但是,如果删除了用于绘制阴影的代码块,过渡过程将照常进行
Then the transition is not smooth at all. However, if it remove a block of codes used to draw a shadow, the transition is smooth as usual
您对此问题有任何想法吗?如果您在
之前经历过,请帮忙。
Do you have any ideas about this issue. Please help if you experienced it before Thanks
推荐答案
指定CALayer shadowPath
。苹果公司说:指定显式路径通常可以提高渲染性能。
Specify the CALayer shadowPath
. Apple says, "Specifying an explicit path usually improves rendering performance."
这篇关于在视图周围绘制阴影会减慢我的过渡速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!