UIImage with rounded corners

In this post I will show a good way to resize UIImage, add shadow, corner radius and still have smooth movement of the image. [css] UIImage *image = [UIImage imageNamed:@"image.png"]; // Begin a new image that will be the new image with the rounded corners // (here with the size of an UIImageView) UIGraphicsBeginImageContextWithOptions(image.size, NO, [UIScreen mainScreen].scale); // Add a clip before drawing anything, in the shape of an rounded rect [[UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, image.size.width, image.size.height) cornerRadius:10.0] addClip]; // Draw your image [image drawInRect:imageView.bounds]; // Get the image UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); // Lets forget about that we were drawing UIGraphicsEndImageContext(); [/css]

Comment

[do_widget “Facebook Comments Master”]