Domanda

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?

È stato utile?

Soluzione

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;
}

Altri suggerimenti

You can do an own PopoverBackgroundView. I have never used UIPopoverBackgroundView, but there's maybe a property for it, but otherwise you can do an own and set the view without rounded corners.

For this you can change green colour to clear colour and then add a UIView on pop over view, with greencolour and add all the other views as its subviews.(This is a tricky way)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top