當我試圖增加currentNumberAdmin
我得到:無法轉換'UILabel!'類型的值預期參數「類型INOUT字符串」
cannot convert value of type 'UILabel!' to expected argument 'type in out String'
class adminPanel: UIViewController {
@IBOutlet weak var currentNumberAdmin: UILabel!
@IBAction func nextCurrent(_ sender: UIButton) {
let database = FIRDatabase.database().reference()
database.child("current").observe(FIRDataEventType.value, with: { (snapshot) in
self.currentNumberAdmin.text = snapshot.value as! String
currentNumberAdmin += String(1)
})
}
}
有誰知道我可以轉換和正確地增加currentNumberAdmin
?
爲什麼要向視圖添加字符串?你想達到什麼目的? –