i have one UIView
and in that UIView
i have UIImageView
& what i have done is set cornerRadius
to that UIView
and also set borderWidth
but i get nearly about 1 pixel space after that UIView
so how can i fix that issue?
view1.clipsToBounds = YES;
view1.layer.cornerRadius = 150;
view1.layer.masksToBounds = YES;
view1.layer.borderColor = [UIColor whiteColor].CGColor;
view1.layer.borderWidth = 50;
view1.layer.opaque = NO;
You can check below image that show 1 pixel spacing.
Here is Demo Project Please Check That To - Click Here
Properties
try using this it will work fine in my project
self.view1.layer.cornerRadius=_slider1.value;//Value as per your requirement
CALayer *borderLayer = [CALayer layer];
CGRect borderFrame = CGRectInset(CGRectZero,-1,-1);
[borderLayer setBackgroundColor:[[UIColor clearColor] CGColor]];
[borderLayer setFrame:borderFrame];
[borderLayer setCornerRadius:_slider1.value];//Value as per your requirement
[borderLayer setBorderWidth:_slider2.value];//Value as per your requirement
[borderLayer setBorderColor:[[UIColor whiteColor] CGColor]];
[self.view1.layer addSublayer:borderLayer];
self.view1.clipsToBounds=YES;
Try this its work fine... i change in your project . give me your email id i will send you.
_view1.layer.cornerRadius = _view1.frame.size.height / 2;
_view1.layer.masksToBounds = YES;
_view1.layer.borderColor = [UIColor whiteColor].CGColor;
_view1.layer.borderWidth = 20;
_img.layer.cornerRadius = _img.frame.size.height / 2 ;
_img.clipsToBounds = YES;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.