Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPopoverBackgroundView without rounded corners

I am making a custom popover background by subclassing UIPopoverBackgroundView. I want to make popover without rounded corners. I can successfully create background without rounded corners (red in picture), but it seems that UIPopoverController adds some rounded corner mask to the content of the popover (green in picture). Here is the picture of the corner of my popover:

enter image description here

Any ideas how I can overcome it?

like image 582
sash Avatar asked Jan 08 '14 10:01

sash


People also ask

How do you remove corner radius in Swift?

Just look for imageView. layer. cornerRadius within the cell implementation, remove it, then jobs done! Maybe the corner radius is being set in the view controller?

What is borderradius?

The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.

How can you created rounded corners using CSS?

To create a rounded corner, we use the CSS border-radius property. This property is used to set the border-radius of element.


1 Answers

I found an easy solution, in the popover content controller (what you pass to initWithContentViewController) add:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.view.superview.layer.cornerRadius = 0;
}
like image 69
sash Avatar answered Nov 06 '22 16:11

sash