have a really strange problem here, this did not happen before iOS 7...
i have a uitextfield and uitextview in a form that i created... the problem is that if the user has the textfield as first responder then taps on the uitextview a deadlock happens, memory will increase until the watchdog kills my app..
This does not happen when I change from uitextview to uitextfield
Relevant code:
#pragma mark - UITextView Delegate
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
}
NSUInteger newLength = [textView.text length] + [text length] - range.length;
return (newLength > 120) ? NO : YES;
}
-(void)textViewDidEndEditing:(UITextView *)textView {
if (textView.tag == CreatePlaceElementDescription) {
self.marker.info = textView.text;
}
else if (textView.tag == CreatePlaceElementAddress) {
self.marker.address = textView.text;
}
}
#pragma mark - UITextField Delegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([string isEqualToString:@"\n"]) {
[textField resignFirstResponder];
}
NSUInteger newLength = [textField.text length] + [string length] - range.length;
//Limit name textfield length
return (newLength > 60) ? NO : YES;
}
-(void)textFieldDidEndEditing:(UITextField *)textField {
if (textField.tag == CreatePlaceElementName) {
self.marker.name = textField.text;
}
}
There is nothing more to this than that...
if i resign first responder first this problem won't happen but it will make the user tap the textview twice and that is undesired..
Also the deadlock happens on textview:didEndEditing, (as if the textview was the one resigning the keyboard not the textfield, textfield:didEndEditing is also called).. textview:didEndEditing should not be called anywhere
it really boggles my mind... any suggestions?