【问题标题】:How can I change the background color of the arrow in an iOS popover in Swift?如何在 Swift 中更改 iOS 弹出窗口中箭头的背景颜色?
【发布时间】:2019-01-01 04:31:41
【问题描述】:

当我将情节提要中 UIView 的背景颜色设置为特定颜色(例如黑色)时,弹出窗口的箭头保持不变(例如白色)。

如何更改箭头的颜色?

【问题讨论】:

  • 如果self.popoverPresentationController?.backgroundColor 不起作用,您可能需要尝试访问该窗口。
  • 如果您将该行包含在您用作弹出框内容的 UIViewController 中,它会起作用

标签: swift xcode uiview storyboard popover


【解决方案1】:

如果您想看到与弹出框背景颜色相同颜色的弹出框箭头,请在 UIViewController(“弹出框”)的“viewDidLoad()”方法中添加以下行:

 override func viewDidLoad() {
    super.viewDidLoad()

    self.popoverPresentationController?.backgroundColor = self.view.backgroundColor
}

iOS popover with changed background color

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-13
    • 2020-01-02
    • 1970-01-01
    • 2013-07-04
    相关资源
    最近更新 更多