Hassy Hassy - 2 months ago 33
Objective-C Question

iOS10 - Corner Radius is not working right with border

I've a

UIViewController
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

i Solved my Problem by following code

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")){
    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.