1.判断内容是否为空
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
NSMutableString * changedString=[[NSMutableString alloc]initWithString:textView.text];
[changedString replaceCharactersInRange:range withString:text];
if (changedString.length!=0) {
_warnLabel.text = @"";
}
return YES;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSMutableString * changedString=[[NSMutableString alloc]initWithString:textField.text];
[changedString replaceCharactersInRange:range withString:string];
if (changedString.length!=0) {
// self.navigationItem.rightBarButtonItem.enabled=YES;
}else{
// self.navigationItem.rightBarButtonItem.enabled=NO;
}
return YES;
}