如何使UisheetPresentationController Prefersgrabbervisible遵循光/暗模式?
在设置uisheetPresentationController
's prefersgrabbervisible
to true
中,我们的应用程序成功地显示了Modal View Controller的顶部的Grabber句柄。
但是,Grabber始终处于系统灯/暗模式,忽略了OverrideUserInterFaceStyle
设置,而忽略了uitraitCollection
覆盖。
我们如何使Grabber尊重特定的视图控制器的光/深色UIUSERINTERFACESTYLE
,而不仅仅是粘附在设备灯/暗模式上?
In setting UISheetPresentationController
's prefersGrabberVisible
to true
, our app successfully displays the grabber handle at the top of modal view controllers.
However, the grabber is always in the system light/dark mode, ignoring the overrideUserInterfaceStyle
setting and ignoring the UITraitCollection
override.
How do we make the grabber respect the specific view controller's light/dark UIUserInterfaceStyle
instead of just adhering to device light/dark mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OverrideUserInterfaceStyle
grabber的视图所覆盖,这就是为什么将此属性设置为视图控制器(或Supperiew)无济于事的原因。因此,您无法控制Grabber的颜色。
但是,如果您真的想更改它,则可以尝试在每次
traitcollectiondidchange(...)
中尝试在子视图中手动查找它的颜色。overrideUserInterfaceStyle
for the grabber is overrided by its view that's why setting this property to a view controller (or superview) doesn't help.Therefore, you can't control the color of the grabber.
However, if you really want to change it, you can try to change color of the grabber manually finding it in subviews each time
traitCollectionDidChange(...)
is called