检测何时在UITextView中删除换行符 - 目标C.

时间:2012-03-30 21:16:04

标签: iphone objective-c xcode uitextview

有什么方法可以检测到在UITextView中删除换行符的时间吗?

感谢。

1 个答案:

答案 0 :(得分:2)

实施委托

-(BOOL)textView:shouldChangeTextInRange:replacementText:

如果发生删除,您将拥有长度为0的replacementText,您可以查看范围内的textView.text以查看删除的内容:

[textView.text substringWithRange:range]