UIView: rounded corners without performance issues

I use AQGridView to display my grid data on an iPad. Each cell is a subclass of UIView and, as a rule, 18 cells are displayed simultaneously.

I would like to add a round corner to these cells, so I set the cornerRadius property of the corresponding layers (i.e. the layer of the main UIView and one subset). However, this leads to performance issues, and scrolling is already awkward. When using other CALayer properties, such as shadowOpacity , this does not happen.

Are there other ways to add a rounded corner (other than using an image)? Or am I doing something wrong?

+7
source share
2 answers

I also noticed that when using the cornerRadius parameter at the view level containing the UIImageView view, great success was achieved. Rasterization resolved this problem: view.layer.shouldRasterize = YES;

+27
source

This may be the place where you place the setCornerRadius call. Make sure it is somewhere that is called only once, and not, for example, with the drawRect method.

0
source

All Articles