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 ?
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With