我正在尝试更改标签文字颜色并查看背景颜色。但是出了点问题。
func ItisDark(){
self.view.backgroundColor = UIColor.blackColor()
self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
self.navigationController?.navigationBar.barTintColor = UIColor.blackColor()
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
questionLabel.textColor = UIColor.whiteColor()
answerLabel.textColor = UIColor.whiteColor()
infoBtn.tintColor = UIColor.whiteColor()
}
func checkDate(sunrise:NSDate, sunset:NSDate){
// Date comparision to compare current date and end date.
let dateComparisionResult:NSComparisonResult = NSDate().compare(sunrise)
let dateComparision:NSComparisonResult = NSDate().compare(sunset)
if dateComparisionResult == NSComparisonResult.OrderedSame || dateComparisionResult == NSComparisonResult.OrderedDescending && dateComparision == NSComparisonResult.OrderedAscending
{
//result is
answerLabel.text = "yes".uppercaseString
self.view.backgroundColor = UIColor.whiteColor()
questionLabel.textColor = UIColor.blackColor()
answerLabel.textColor = UIColor.blackColor()
}else{
answerLabel.text = "no".uppercaseString
//here is the problem!
ItisDark()
}
}
我在空项目中尝试了这段代码。一切都很完美。但是我在另一个项目中看着白屏。你在想什么问题?