How can do this with cornerRadius
and also I'm using UIImageView

- 1,388
- 3
- 16
- 37
-
3Read this thread, maybe can help you. http://stackoverflow.com/questions/10167266/how-to-set-cornerradius-for-only-top-left-and-top-right-corner-of-a-uiview – Benjamin RD Oct 25 '14 at 09:16
-
I have up voted urs hope to get it back in my answer too – Nischal Hada Jun 20 '15 at 14:17
3 Answers
All You want to do is
First of all you should Add the QuartzCore.framework through the Click your project-It is in left side of the Navigator Area Then click your project name of the TARGETS(It is below PROJECT-Left Side) Select Build Phases. If you select that you can see the 4 options. Then click Link Binary with Libraries. Once you click that just type Quartzcore. It shows that framework.Then just add it.
Import #import in your relevent view controller.
Do the foollowing code in your .m part
yourImage.layer.cornerRadius = 5.0; //For Example i give 5.0.So just give your required size. yourImage.layer.borderWidth = 3.0f; yourImage.layer.borderColor = [UIColor whiteColor].CGColor; //just give the color whatever you want yourImage.clipsToBounds = YES;
Once it works let me know.

- 10,792
- 3
- 58
- 102

- 9,459
- 3
- 32
- 39
- One master UIView without set Layer corner
- add another UIImageView on it
[view addSubview:imageView];
- set the layer corner on the UIImageView
- set the frame for the UIImageView (e.g. imageView.frame = CGRectMake(0, -20.f, weight, height);
- This should work, if not, set the bounds for the UIView and clipToBounds = YES
If this works, please give me a good one as I am low in points XD

- 178
- 3
- 14
To make the circular imageview use this following code in viewDidLoad. For clipped to bounds set it yes
self.MyImageView.layer.cornerRadius = self.MyImageView.frame.size.width / 2;
self.MyImageView.clipsToBounds = YES;
To apply the border use this code in viewDidLoad
self.MyImageView.layer.borderWidth = 3.0f;
self.MyImageView.layer.borderColor = [UIColor whiteColor].CGColor;

- 3,230
- 3
- 27
- 57