过渡到 UIDocumentInteractionController 接管导航栏标题颜色
仅执行简单的过渡uidocumentInteractionController以显示PDF。它的标题是黑色的,这是必需的,但是我希望它返回时返回到应用程序颜色(白色)。试图强迫ViewWillAppear的更改无济于事(尽管我看到ViewWillAppear被称为)。我还尝试在DocumentInteractionControllerDidendPreview中更改颜色,但又一无所获。颜色保持黑色。 使用以下内容来改变颜色:
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
self.navigationController?.navigationBar.largeTitleTextAttributes = textAttributes
给uidocumentInstractionController导航控制器:
open func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
guard let vc = self.navigationController else {
fatalError("No navigation controller")
}
return vc
}
在介绍文档和白色(或我想要的任何颜色)时,我该如何返回时,我该如何有黑色标题?这应该是简单的事情,但我一直在圈出。
Just doing a simple transition a UIDocumentInteractionController to display a PDF. Its title is black, which is desired, but I want it to go back to the app color (white) when it goes back. Trying to force a change in viewWillAppear does nothing (though I do see viewWillAppear is being called). I also tried changing the color in documentInteractionControllerDidEndPreview but again nothing happens. The color stays black.
Using the following to change the color:
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
self.navigationController?.navigationBar.largeTitleTextAttributes = textAttributes
Giving the UIDocumentInteractionController the navigation controller:
open func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
guard let vc = self.navigationController else {
fatalError("No navigation controller")
}
return vc
}
How can i have a black title when presenting the document and white (or whatever color I desire) when i go back? This should be something simple but ive been going in circles.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在ViewDidload中调用此问题解决了问题
Calling this in viewDidLoad fixed the problem