Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

image in circle frame iOS [closed]

Tags:

i have uitableview with a list of contact. I would like to have the image of each contact in an circle frame like in the login screen of mavericks. Any suggestions how to do this in an uitableviewCell ?

enter image description here

like image 436
jonas vermeulen Avatar asked Oct 28 '13 17:10

jonas vermeulen


People also ask

How do you make a picture a circle on iPhone?

Tap + and choose Image, then select the pic you want to crop. Choose Cut Out > Shape and select the circle. Drag your finger on the photo to create your circle. You can also pinch to scale it to the correct size.

How do I round an image in Objective C?

To make a circular image from a squared image, we need to use the radius and set it to the half of the width of UIImageView. If the width of your squared image is 200 pixels. The radius is set to 100 pixels i.e half of the width. Later, you need to set the clipsToBounds property to YES in order to make the layer works.


1 Answers

I presume that you have your imageView inside your Cell, so what your have just to do for have the same effect is use a invisible border. Use this code for make this effect:

cell.yourImageView.layer.cornerRadius = cell.yourImageView.frame.size.height /2; cell.yourImageView.layer.masksToBounds = YES; cell.yourImageView.layer.borderWidth = 0; 

Your UIImageView must have the same height and width also you have to import the quartzCore framework in your project

like image 163
Mirko Catalano Avatar answered Sep 21 '22 01:09

Mirko Catalano