Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 910
Hassy Avatar asked Dec 14 '22 03:12

Hassy


1 Answers

Your code is good but it is missing one line,

view.clipsToBounds = true

Set this line and run again.

Hope this will help you.

like image 126
KAR Avatar answered Dec 16 '22 15:12

KAR