首先导入ReactiveCocoa
let textView = UITextView()
let placeHolder = UILabel()
_ = textView.reactive.continuousTextValues.observeResult(
{ (result) in
if ((textView.text.characters.count) > 0) {
placeHolder.isHidden = true
}else
{
placeHolder.isHidden = false
}
})
相比于之前设置代理来实现方便的多
网友评论