How to get rounded corners on a UIImageView ?

Home/English/Development Tips/To Begin with Objective-C / Cocoa/How to get rounded corners on a UIImageView ?

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 😀

Imagine you’ve got an UIImageView named myImage…

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

Adding :

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

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 🙂

About the Author:



NOUS CONTACTER

WPTechnology - SeeYouDancin SAS
Demande de devis, besoin d'information, n'hésitez-pas :

Contactez-nous