标签:cornerradius 卡顿 圆角
- (UIImageView *)imageWithRoundedCornersSize:(float)cornerRadius { UIImageView *imageView = self; UIImage * original = self.image; // Begin a new image that will be the new image with the rounded corners // (here with the size of an UIImageView) UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, [UIScreen mainScreen].scale); //[UIScreen mainScreen].scale // Add a clip before drawing anything, in the shape of an rounded rect [[UIBezierPath bezierPathWithRoundedRect:imageView.bounds cornerRadius:cornerRadius] addClip]; // Draw your image [original drawInRect:imageView.bounds]; // Get the image, here setting the UIImageView image imageView.image = UIGraphicsGetImageFromCurrentImageContext(); // Lets forget about that we were drawing UIGraphicsEndImageContext(); return imageView; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
设置UIView圆角 cornerRadius 圆角有性能问题,用贝塞尔曲线代替
标签:cornerradius 卡顿 圆角
原文地址:http://blog.csdn.net/shaobo8910/article/details/46779259