最近项目中需要通过判断用户是否对资料进行更改,从而确定是否允许用户提交信息的功能,就以这种方式实现了。
使用前需要实现UITextViewDelegate协议,并设置UITextView的delegate。
- (void)textViewDidChange:(UITextView *)textView
{
NSLog(@"[======]info introduction is %@",textView.text);
if (![textView.text isEqualToString:profile.introduction]) {
[self setRightBarButton];
}else
{
[self setRightBarItem:nil];
}
}