Table of contents
Share Post

Basic question, and sometimes we’re thinking of non « basic » answer because as a beginner, we’re not comfortable enough on using all magical stuff from objective-C/Cocoa…
Well, in reality, we can let Quartz do that by itself :D

Imagine you’ve got an UIImageView named myImage…

The only two things you’ve got to do to get rounded corner are :

Adding :

#import 

To your current view file, then, after your declaration code for the UIImageView named myImage, just add this :

myImage.layer.cornerRadius = 9.0;
myImage.layer.masksToBounds = YES;

Note that the value after « cornerRadius » indicates how rounded the corner will be… Smaller value will result in a rounded corner closed to a square, bigger will look like a circle :p

That’s it :)

laurent

Stay in the loop

Subscribe to our free newsletter.

Related Articles