|
@@ -62,6 +62,10 @@ const char kProcessedImage;
|
|
* @brief clip the cornerRadius with image, UIImageView must be setFrame before, no off-screen-rendered
|
|
* @brief clip the cornerRadius with image, UIImageView must be setFrame before, no off-screen-rendered
|
|
*/
|
|
*/
|
|
- (void)cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType {
|
|
- (void)cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType {
|
|
|
|
+ if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
|
|
|
|
+ self.image = [[UIImage alloc] init];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
CGSize size = self.bounds.size;
|
|
CGSize size = self.bounds.size;
|
|
CGFloat scale = [UIScreen mainScreen].scale;
|
|
CGFloat scale = [UIScreen mainScreen].scale;
|
|
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
|
|
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
|
|
@@ -89,6 +93,10 @@ const char kProcessedImage;
|
|
* @brief clip the cornerRadius with image, draw the backgroundColor you want, UIImageView must be setFrame before, no off-screen-rendered, no Color Blended layers
|
|
* @brief clip the cornerRadius with image, draw the backgroundColor you want, UIImageView must be setFrame before, no off-screen-rendered, no Color Blended layers
|
|
*/
|
|
*/
|
|
- (void)zy_cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType backgroundColor:(UIColor *)backgroundColor {
|
|
- (void)zy_cornerRadiusWithImage:(UIImage *)image cornerRadius:(CGFloat)cornerRadius rectCornerType:(UIRectCorner)rectCornerType backgroundColor:(UIColor *)backgroundColor {
|
|
|
|
+ if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) {
|
|
|
|
+ self.image = [[UIImage alloc] init];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
CGSize size = self.bounds.size;
|
|
CGSize size = self.bounds.size;
|
|
CGFloat scale = [UIScreen mainScreen].scale;
|
|
CGFloat scale = [UIScreen mainScreen].scale;
|
|
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
|
|
CGSize cornerRadii = CGSizeMake(cornerRadius, cornerRadius);
|