我怎樣才能顏色狀態欄我得到了消失的時候我滾動我的表,但在狀態欄電池去一個導航欄...如何給狀態欄上色?
在這裏有我的導航控制器
class NavigationController : UINavigationController
{
override func viewDidLoad()
{
super.viewDidLoad()
UINavigationBar.appearance().barTintColor = Utility().coloreTitolo()
UINavigationBar.appearance().translucent = false;
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
}
我試試這個代碼但是當我向下滾動視圖顯示太...
func scrollViewDidScroll(scrollView: UIScrollView)
{
let statusBar = UIView(frame:
CGRect(x: 0.0, y: 0.0, width: UIScreen.mainScreen().bounds.size.width, height: 20.0)
)
statusBar.backgroundColor = Utility().coloreTitolo()
statusBar.tag = 100;
if(scrollView.panGestureRecognizer.translationInView(scrollView).y > 0)
{
self.view.addSubview(statusBar)
}
else
{
let subViews = self.navigationController?.navigationBar.subviews
for subview in subViews!
{
if (subview.tag == 100) {
subview.removeFromSuperview()
}
}
}
}
你們是不是要顏色在狀態欄中的文本 –