문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top