Note that there are some explanatory texts on larger screens.

plurals
  1. PODeadlock when changing first responder from uitextfield to uitextview [iOS 7]
    text
    copied!<p>have a really strange problem here, this did not happen before iOS 7...</p> <p>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..</p> <p>This does not happen when I change from uitextview to uitextfield</p> <p>Relevant code:</p> <pre><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 &gt; 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 &gt; 60) ? NO : YES; } -(void)textFieldDidEndEditing:(UITextField *)textField { if (textField.tag == CreatePlaceElementName) { self.marker.name = textField.text; } } </code></pre> <p>There is nothing more to this than that...</p> <p>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..</p> <p>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</p> <p>it really boggles my mind... any suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload