当我按q时,我收到错误。我知道什么是错的,但我不知道我会怎么做。在编程的开始,感谢已经
@IBOutlet var HS: UILabel!
@IBOutlet var S: UILabel!
override func viewDidLoad()
{
super.viewDidLoad()
let HighscoreDefault = UserDefaults.standard
let ScoreDefault = UserDefaults.standard
print("Hi")
if HighscoreDefault.value(forKey: "Highscore") != nil
{
let Highscore = HighscoreDefault.value(forKey: "Highscore") as! Int
let Score = ScoreDefault.value(forKey: "Score") as! Int
print(Highscore)
print(Score)
S.text = NSString(format: "Score : %i", Score as CVarArg) as String
HS.text = NSString(format: "Highcore : %i", Highscore as CVarArg) as String
}