Use Rounded Image VIew in IOS App

We can use Rounded Image in IOS Application.

Step 1 : Create an Image View either using the Interface builder or by code
Note that the width and height should be same.

Now we are creating it by code

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
imgView.image = [UIImage imageNamed:@"test_image.png"];

here in CGRectMake(10, 10, 100, 100) first two parameters defines x and y co-ordinate to position the image, then the 3rd and 4th parameter is the width and height.

Step 2 : Now apply radius for the image view

imgView.layer.cornerRadius = 50;
[imgView.layer setMasksToBounds:YES];

Put the raduis value to half of the width/height.

Step 3 : Clean your xcode project and Run… You can see now the rounded image… Done…

Sharing is caring!

Leave a Comment