QuartzCore shadow - lag UITableView?

2019-06-14 10:14发布

问题:

I have an UITableView (NOTE:The UITableView is in a UIView) and I thought it would be nice to have an shadow added below it. I add the shadow with QuartzCore and it turns out really nice. But I also notice that when I come back from a 'Detail View' the animation back to the root is a bit lag. I've heard that QuartzCore and CoreAnimation can make the app slower, or in this case, add lag.

First, am I right that CoreAnimation makes the app slower?

If so, how can I keep my shadow but remove the slowness and lag?

Thanks and I appreciate all thoughts and answers!

回答1:

Try putting another view the same size behind the table view and have that view generate the shadow. Also, layer shadows are much more efficient if you supply an explicit shadowPath. The most efficient way is to draw the shadow yourself using Core Graphics.