这是一个不触发离屏渲染设置圆角的小工具类。您可以轻松地将界面帧率保持在60fps左右,这样可以保证效果更平滑。
推荐通过 CocoaPods
pod 'AYViewCorner'
运行 pod install
或 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 文件。
这是一个不触发离屏渲染设置圆角的工具类。你可以很容易的保持界面的FPS保持在60左右,足以保证流畅。
推荐使用CocoaPods进行安装。
pod 'AYViewCorner'
然后输入 pod install
或 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 文件。