shouldChangeCharactersInRange , , ( ) . , , YES .
control reaches end of non-void function
, non-void, - . , .
, , , . , , .
userInput.text , , . , .
NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string]);
:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString *newText = [textField.text stringByReplacingCharactersInRange:range withString:string];
BOOL isFieldEmpty = [newText isEqualToString:@""];
sendButton.enabled = !isFieldEmpty;
return YES;
}