ahe*_*ang 5 iphone objective-c uiview ipad ios
所以我有一个有阴影的UIView:
[containerFrame.layer setShadowOffset:CGSizeMake(0, 1)];
[containerFrame.layer setShadowRadius:4.0];
[containerFrame.layer setShadowColor:[UIColor colorWithRed:34/255.f green:25/255.f blue:25/255.f alpha:1.0].CGColor];
[containerFrame.layer setShadowOpacity:0.4];
Run Code Online (Sandbox Code Playgroud)
有了这个,我的滚动FPS下降到20-30.移除阴影然后繁荣,我的FPS回到60并且滚动像黄油一样光滑.现在问题是我需要在这个盒子/容器视图周围有一个阴影效果.如何在不降低滚动速度的情况下实现这一目标?
Mic*_*son 16
尝试设置阴影路径:
[containerFrame.layer setShadowOffset:CGSizeMake(0, 1)];
[containerFrame.layer setShadowRadius:4.0];
[containerFrame.layer setShadowColor:[UIColor colorWithRed:34/255.f green:25/255.f blue:25/255.f alpha:1.0].CGColor];
[containerFrame.layer setShadowOpacity:0.4];
// New line
[containerFrame.layer setShadowPath:[UIBezierPath bezierPathWithRect:containerFrame.bounds].CGPath];
Run Code Online (Sandbox Code Playgroud)
如果你必须为这个视图设置动画(特别是如果它是UITableViewCell的一部分),你可能会注意到动画中的断断续续.这是因为计算视图的投影需要Core Animation执行屏幕外渲染过程以确定视图的确切形状,以便弄清楚如何渲染其投影.(请记住,您的视图可能是任何复杂的形状,甚至可能有洞.)
| 归档时间: |
|
| 查看次数: |
1837 次 |
| 最近记录: |