好吧,我不知道發生了什麼事。即時通訊相對較新的iOS,所以我的調試技能不在他們需要的地方。我有一個文本字段工作得很好,直到我在我的應用程序中做了一些更改,沒有任何與文本字段有關的更改(至少我認爲他們沒有)。我不斷收到這個錯誤「 - [NSNull length]:無法識別的選擇器發送到實例0x1a1803490」後,我嘗試鍵入。在調試區域打印後「確實開始編輯」。任何幫助表示讚賞。提前致謝。UITextField問題
這裏是我的代碼:
@IBAction func textFieldActions(sender: AnyObject) {
print("text field actions")
}
func textFieldDidBeginEditing(textField: UITextField) {
textField.becomeFirstResponder()
print("did begin editing")
}
func textFieldDidEndEditing(textField: UITextField) {
textField.resignFirstResponder()
print("did end ediditing")
}
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
textField.text = nil
return true
}
我這樣做了,但在調試區域中沒有任何不同。 – user3462448