这确实有效:
在ApplicationController
'spresentVisitableForSession()
中,设置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)
}
}