У меня есть розетка, подключенная для textView и кнопки «Далее»:
Код: Выделить всё
@IBOutlet weak var textView: UITextView!
@IBOutlet weak var nextButton: UIBarButtonItem!
func textView(textView: UITextView, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
let oldText: NSString = textView.text
let newText: NSString = oldText.stringByReplacingCharactersInRange(range, withString: string)
if newText.length > 0 {
nextButton.enabled = true
} else {
nextButton.enabled = false
}
return true
}
Подробнее здесь: https://stackoverflow.com/questions/275 ... e-in-swift
Мобильная версия