简体   繁体   English

在UIAlertController操作表(iPad)中更改分隔符颜色

[英]Change separator colour in UIAlertController action sheet (iPad)

I'm programming a UIAlertController for a popover on the iPad. 我正在为iPad上的弹出窗口编程UIAlertController。 I know you can set the background colour of the ActionSheet like this: 我知道您可以这样设置ActionSheet的背景颜色:

myAlertController.popoverPresentationController?.backgroundColor = myColour

And you can set the text colour of the buttons like this: 您可以这样设置按钮的文本颜色:

myAlertController.view.tintColor = anotherColour

What I'd like to do though is set the colour of the horizontal separators between UIActions. 我想做的是设置UIAction之间的水平分隔符的颜色。 I have looked at the popover's subview hierarchy and I can see that, internally, it uses a UICollectionView. 我已经看过了Popover的子视图层次结构,并且可以在内部看到它使用UICollectionView。

So how would I change the separator colour , be it: 因此,我将如何更改分隔符的颜色

  • a hacky way via the subview hierarchy? 通过子视图层次结构的变种方式? Or, preferably, 或者,最好是
  • an official way that I can't see in the docs? 我在文档中看不到的正式方式?

Thanks 谢谢

There is no available property for UIAlertViewController for customising the separators UIAlertViewController没有可用于自定义分隔符的属性

You have to go through the subview hierarchy 您必须遍历子视图层次结构

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM