答案 0 :(得分:0)
否,您不能更改SFSafariViewController的URL“标题”颜色。它是您网页的默认视图。如果需要自定义,则可以使用WKWebView。
答案 1 :(得分:0)
尝试一下
UINavigationBar.appearance().backgroundColor = UIColor.green
UINavigationBar.appearance().tintColor = UIColor.red
let attrs = [
NSForegroundColorAttributeName: UIColor.red
]
UINavigationBar.appearance().titleTextAttributes = attrs
来源:https://github.com/zendesk/zendesk_sdk_chat_ios/issues/130
答案 2 :(得分:0)
import SafariServices
extension UIViewController {
/// Safari Service ViewController with
/// - parameter link: initial load url
func openSafariService(withURL link: String) {
// let url = link.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
if link.isNotBlank {
let safariVC = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: true)
safariVC.preferredBarTintColor = UIColor.themeBlue
safariVC.preferredControlTintColor = UIColor.white
self.present(safariVC, animated: true, completion: nil)
}
}
}
// Update navigation bar
func updateNavigationBar() {
navigationController?.navigationBar.barTintColor = UIColor.themeBlue
navigationController?.navigationBar.tintColor = UIColor.white
navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white,
NSAttributedStringKey.font: UIFont.customFont(size: 17.0)]
}
我对导航栏进行了更新,然后将safariService函数称为对我来说正常工作。