liuzhiyi1992 / ZYCornerRadius

一句代码,圆角风雨无阻。A Category to make cornerRadius for UIImageView have no Offscreen-Rendered, be more efficiency.

Home Page:http://zyden.vicp.cc/zycornerradius/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

卡顿

rmcgege opened this issue · comments

设置了 几十个 VIEW 在 控制器view 上 ,不需要滚动 ,但要切圆角,push到下一个控制器 的时候回卡顿,楼主能赐教不。

@rmcgege 可否有Demo提供?减少数量后卡顿会消失吗请问?

减少数量卡顿没了 , 我想问的是 , 网上都说滚动的时候 会卡顿 ,我这个为什么push到别的控制器 ,这个过程会卡顿啊 ,方便加微信 QQ么?你的这个 分类 是把imageView的图片切圆角了啊 ,没有吧imageView 切圆角,我 是创建了 几十个VIEW.需要把 view 切圆角,

我刚开始用的 UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(120, 10, 80, 80)];
view2.backgroundColor = [UIColor redColor];
[self.view addSubview:view2];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view2.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = view2.bounds;
maskLayer.path = maskPath.CGPath;
view2.layer.mask = maskLayer;
这个方法,push到下一个控制器非常的卡顿

@rmcgege 不建议多处使用mask,一个mask就可能带来性能问题。
UIView的切角不会带来性能问题,不需要用第三方库,直接使用系统的setCornerRaidus即可。
ZYCornerRadius仅是对UIImageView图片切角,不用于对UIView backgroundColor实现切角效果(直接使用CA的 cornerRadius即可)