• Stars
    star
    1,450
  • Rank 32,448 (Top 0.7 %)
  • Language
    Objective-C
  • Created over 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

ZYCornerRadius
一句代码,圆角风雨无阻

A Category to make cornerRadius for UIImageView have no Offscreen-Rendered, be more efficiency 避免为UIImageView设置圆角时触发离屏渲染所带来的性能损耗,两种工作方式:Category和UIImageView子类。

##CocoaPods:

pod 'ZYCornerRadius', '~> 1.0.2'

##性能对比:
测试设备6P,屏幕中有40张尺寸为20*20的小图片,使用masksToBounds切角处理时帧率大大下降至20+,使用ZYCornerRadius时帧率保持在57+,性能接近0损耗。

内存使用对比:


##Usage:

导入头文件

#import "UIImageView+CornerRadius.h"

创建圆角半径为6的UIImageView(两种种方式):

//1
UIImageView *imageView = [[UIImageView alloc] initWithCornerRadiusAdvance:6.0f rectCornerType:UIRectCornerAllCorners];

//2
UIImageView *imageView = [[UIImageView alloc] init];
[imageView zy_cornerRadiusAdvance:6.0f rectCornerType:UIRectCornerAllCorners];

创建圆形的UIImageView(两种方式):

//1
UIImageView *imageView = [[UIImageView alloc] initWithRoundingRectImageView];

//2
UIImageView *imageView = [[UIImageView alloc] init];
[imageView zy_cornerRadiusRoundingRect];

可为UIImageView的图片附加边框:

[imageView zy_attachBorderWidth:1.f color:[UIColor redColor]];

按你的需要完成配置后,任何时候对UIImageView setImage,效果都会生效

//anytime 
imageView.image = [UIImage imageNamed:@"mac_dog"];

##iteration: 1.0.2 - 处理Xcode8带来的问题 1.0.1 - fix重大bug, 整理代码 0.9.4 - 处理多个swizzleMethod的问题 0.9.3 - 处理上版本制造的bug 0.9.2 - 处理ContentMode无效问题 0.9.1 - 处理 setImage发生在 frame计算之前(Masonry) 导致圆角无效的问题,此版本删除ZYImageView,统一使用UIImageView+CornerRadius 0.8.1 - 解决更新图片时图片内容闪动问题。 0.7.1 - 去除部分api,保持使用简洁的设计理念,加入带边框功能 0.6.1 - 解决在TableViewCell被selected后,其中UIImageView的image被重置的问题 0.5.1 - 解决SDWebImage使用placeholder为nil时发生的crash 0.4.1 - 发布第一个较完善版本
##Relation: [@liuzhiyi1992](https://github.com/liuzhiyi1992) on Github [@Blog](http://zyden.vicp.cc/) Welcome
##License: ZYCornerRadius is released under the MIT license. See LICENSE for details.

More Repositories

1

ZYThumbnailTableView

a TableView have thumbnail cell only, and you can use gesture let it expands other expansionView, all diy
Swift
945
star
2

ZYSideSlipFilter

Awesome side slip filter for your display rack, 侧边栏条件筛选器,筛选区域模块插拔,AutoLayout动态适配区域高度
Objective-C
661
star
3

WaveLoadingView

a loading indicator like water wave
Objective-C
570
star
4

SpreadButton

a Button can spread its sub path button like the flower if you click,once again,close. oc & swift
Swift
529
star
5

ZYKeyboardUtil

一个Block,全自动处理键盘遮挡输入控件问题。Util Handed all keyboard events with Block Conveniently
Objective-C
421
star
6

PreLoader

A Loading Indicator to draw attention effectively.
Objective-C
139
star
7

UCToutiaoClone

1:1超高仿UC头条, 品质阅读资讯App, 官方主页http://toutiao.uc.cn/, 开源项目, 欢迎补充
Objective-C
112
star
8

MyshareBlogs

Record articles i has been share
66
star
9

ZYLocationManager

Request location information any time any where conveniently
Objective-C
18
star
10

DynamicNavigationBar

动态(展开-收缩)NavigationBar
Objective-C
9
star
11

ZYCarouselScroller

carousel scroller with your custom CardCell
Objective-C
6
star
12

SpeedFreezingVideo

Objective-C
6
star
13

FlagProgressBar

a progress bar(index, volume) with above image flag, and bottom title flag if you need
Objective-C
5
star
14

UIImageView-sport-category-

图片下载进度指示器(category方式实现)
Objective-C
1
star
15

ImageLoadingIndicator

图片加载指示器(oc,swift)
Objective-C
1
star
16

GhostTheme

CSS
1
star
17

MyStore

Objective-C
1
star