我在CollectionView当中把每个cell都通过cornerRadius的方式设为了圆形。
cell.imageView.layer.cornerRadius = 20;
cell.imageView.layer.maskToBounds = YES;
就是加了maskToBounds的时候会卡,但是不加又没有圆角的效果
求大神指教啊
cell.imageView.clipsToBounds = YES;试试
卡得厉害的话,你只能做一张跟 imageView
一样大小的黑白图了,中间是白的,圆角矩形,剩下的是黑的,将这个图做为 layer.mask
。
用了 mask 就不要 cornerRadius = 20
了