UIView default styling has rounded corners?

后端 未结 3 598
渐次进展
渐次进展 2021-01-15 01:24

I am using a UIPopoverController to display a UIView. The layout is somewhat similar to a UISplitViewController so it is very strange

相关标签:
3条回答
  • 2021-01-15 01:51

    The black gradient color frame with rounded corner is default for UIPopoverController. However you can use a custom class to set the background view . Here try following link.

    change color navigation controller in a popover

    0 讨论(0)
  • 2021-01-15 01:58

    For anyone who uses UIPopoverPresentationController, the following should work.

    override open func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    
        view.superview?.layer.cornerRadius = 0
    }
    
    0 讨论(0)
  • 2021-01-15 02:12

    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.

    0 讨论(0)
提交回复
热议问题