【问题标题】:How to set the background color in turbolinks-ios?如何在 turbolinks-ios 中设置背景颜色?
【发布时间】:2016-08-13 07:33:48
【问题描述】:
【问题讨论】:
标签:
ios
uiwebview
turbolinks-ios
【解决方案1】:
这确实有效:
在ApplicationController's presentVisitableForSession()中,设置visitable.visitableView.backgroundColor。
例如:
// ApplicationController.swift
class ApplicationController: UINavigationController {
// ...
func bgColor() -> UIColor? {
return UIColor(red: 0, green: 103/255, blue: 170/255, alpha: 1)
}
private func presentVisitableForSession(session: Session, URL: NSURL, action: Action = .Advance) {
let visitable = MainViewController(URL: URL)
visitable.visitableView.backgroundColor = bgColor() // <-- ADD THIS LINE
if action == .Advance {
pushViewController(visitable, animated: true)
} else if action == .Replace {
popViewControllerAnimated(false)
pushViewController(visitable, animated: false)
}
session.visit(visitable)
}
}