美文网首页DevSupportiOS开发进阶iOS学习笔记
iOS 四种切圆角方法性能对比

iOS 四种切圆角方法性能对比

作者: Sunxxxxx丶 | 来源:发表于2017-11-11 16:37 被阅读43次

一.目的

有人说系统方法切圆角不好.有人又说没什么问题.
有人说用CAShapLayer的mask做圆角最好.
有人说用CoreGraphics切图片最好.
最后都看糊涂了.所以亲身测试了一下.

用CoreAnimation测试4中切圆角方法的优劣.
图片的左边为用instruments的Core Animation工具查看的帧率.
图片的右边为用instuments的Core Animation工具查看离屏渲染的区域.

用数据说话.如下:

代码见: https://github.com/moonbeammm/GXPhone.git

见类: GXPhoneCornerTestCell

如果不想下载源码可以直接下载我的Cell类文件.如下地址:
http://www.sunxxxxx.com/sgx/others/cornerClass.zip

二.测试类型

1.无圆角

2.有圆角->系统方法

3.有圆角->CAShapLayer

4.有圆角->CGGraphics

5.有圆角->蒙一个圆角图片

三.真机机型

iPod iOS 8.4.1

iPhone 6s iOS9.3.1

iPhone6 iOS11

四.运行环境

1.全部安装release包

2.一排8张图片.

3.总行数1000行.

4.图片全部为网络下载.

五.运行数据

iPod iOS8.4.1如下:

1.无圆角

image.png

2.有圆角->系统方法

image.png

3.有圆角->CAShapLayer

image.png

4.有圆角->CGGraphics

image.png

5.有圆角->蒙一个圆角图片

image.png

iPhone 6 iOS11如下:

1.无圆角

image.png

2.有圆角->系统方法

image.png

3.有圆角->CAShapLayer

image.png

4.有圆角->CGGraphics

image.png

5.有圆角->蒙一个圆角图片

image.png

iPhone 6s iOS9.3.1如下:

1.无圆角

image.png

2.有圆角->系统方法

image.png

3.有圆角->CAShapLayer

image.png

4.有圆角->CGGraphics

image.png

5.有圆角->蒙一个圆角图片

image.png

相关文章

网友评论

    本文标题:iOS 四种切圆角方法性能对比

    本文链接:https://www.haomeiwen.com/subject/hbzwmxtx.html