Hassy Hassy - 1 year ago 138
Objective-C Question

iOS10 - Corner Radius is not working right with border

I've a

and I'm displaying it as UIModalPresentationPopover. It had its corner radius set to 10.0 and border width to 1.0.

- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];

self.view.layer.borderWidth = 1.0f;
self.view.layer.cornerRadius = 10.0f;
self.view.layer.masksToBounds = YES;

It is not showing any border along corner radius and it is giving a weird effect. It was working fine before iOS10. What should I do to solve this problem?

Edit: The screenshots are as
enter image description here

If i add 2 pixel border then still 1 pixel is missing from View
enter image description here

Answer Source

i Solved my Problem by following code

    self.view.superview.layer.cornerRadius = 15.0f;

I did set the view corner radius to 10.0 so 15.0 was exact value at which the superview wont meddle with its subview corner radius and borders to show it as blur or 1 pixel less.

Edit: Custom created UIViewController if animated might need to implement above code after it has finished animating.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download