Question

I built a custom Popoverview, but fail to remove the content's rounded corners.

Tried to set .layer.cornerRadius = 0.0 in almost every view in found, with no success.

Image Link: Custom Popover

Red border is of UIViewController used to init the UIPopoverController with, green is background of custom UIPopoverBackgroundView.

Was it helpful?

Solution

Answer from this thread: UIView default styling has rounded corners?

There is no supported way to make the view inside of your UIPopoverController not have rounded corners. The internal code of the UIPopoverController adds your view to a view with rounded corners that clips to bounds.

There may be a hackish way to do it, i.e. waiting until the UIPopoverController is shown and then traversing through all of the parent's of your view and setting them all to have cornerRadius = 0; and clipsToBounds = NO;, but even if you find a solution it might not be compatible with all versions of iOS and if Apple changes some internal code of UIPopoverController in the future then your solution could break.

If you really want to do this then the best way to go is to create your own class that mimics the UIPopoverController functionality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top