How to remove rounded corners in PopoverView?

五迷三道 提交于 2019-12-10 19:42:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/22710213/how-to-remove-rounded-corners-in-popoverview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!