TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2016 |
Maintained by AYJk.
This is a utility class which can help you set round corner without offScreen rendered.
You can easily hoding frames at 60fps, the effect looks more smoother than layer.cornerRadius
.
The perferred way of installation is via CocoaPods
pod 'AYViewCorner'
and run pod install
or pod update
. It will install the most recent version of AYViewCorner.
After that import <AYViewCorner/AYViewCorner.h>.
If you want set UIButton with round corner, I suggest you invoke:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius setNormalImage:(UIImage *)normalImage highlightedImage:(UIImage *)highlightedImage disabledImage:(UIImage *)disableImage selectedImage:(UIImage *)selectedImage backgroundColor:(UIColor *)color;
If you want set UIView or UILabel with round corner, I suggest you invoke:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundColor:(UIColor *)color;
If you want set UIImageView with round corner, I suggest you invoke:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundImage:(UIImage *)image backgroundColor:(UIColor *)color;
At the same time, if you want to set UIViewContentMode with UIImageView,I suggest you invoke:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundImage:(UIImage *)image backgroundColor:(UIColor *)color withContentMode:(UIViewContentMode)contentMode;
If both the image and color are set ,it only show the image.
v 1.0.1 fix some info
v 1.0.0 first version
AYViewCorner is provided under the MIT license. See LICENSE file for details.
这是一个不触发离屏渲染设置圆角的工具类。你可以很容易的保持界面的FPS保持在60左右,足以保证流畅。
推荐使用CocoaPods进行安装。
pod 'AYViewCorner'
然后输入 pod install
or pod update
。将会安装最新版本的AYViewCorner。
最后导入头文件<AYViewCorner/AYViewCorner.h>
如果你想要设置 UIButton 的圆角,建议调用下面的方法:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius setNormalImage:(UIImage *)normalImage highlightedImage:(UIImage *)highlightedImage disabledImage:(UIImage *)disableImage selectedImage:(UIImage *)selectedImage backgroundColor:(UIColor *)color;
如果你想要设置 UIView/UILabel 的圆角,建议调用下面的方法:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundColor:(UIColor *)color;
如果你想要设置 UIImageView 的圆角,建议调用下面的方法:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundImage:(UIImage *)image backgroundColor:(UIColor *)color;
同时,如果你想设置 UIImageView 的 UIViewContentMode,建议调用下面的方法:
- (void)ay_setCornerRadius:(AYRadius)cornerRadius backgroundImage:(UIImage *)image backgroundColor:(UIColor *)color withContentMode:(UIViewContentMode)contentMode;
如果同时设置图片和颜色,只会显示图片。
v 1.0.1 修正一些信息
v 1.0.0 首次提交
AYViewCorner 使用 MIT 许可证,详情见 LICENSE 文件。