I have a chat application that implements a floating text input field (similar to the iOS Messages app) as the inputAccessoryView of my ChatViewController (see Apple's documentation).
class ChatViewController: UIViewController { override var inputAccessoryView: UIView? { return chatInputView } override var canBecomeFirstResponder: Bool { return true } ... My ChatViewController has a ChatTableViewController child view controller, which has cells containing UITextFields whose text content is editable. The issue I'm running into is that when the user taps on a cell's UITextField, the inputAccessoryView's UITextView refuses to resign first responder status, which prevents the content in the UITableViewCell from being edited. The following warning is logged in the console:
First responder warning: '<UITextView: 0x7fc041041c00; frame = ...' rejected resignFirstResponder when being removed from hierarchy I've tried calling resignFirstResponder and endEditing on the UIInputView and UITextView directly with no success. I don't want the ChatViewController to resign first responder status as that would cause the inputAccessoryView to disappear.
1 Answers
Answers 1
Could you please check the following:
If UITextView is removed from super view:
- Is the
UITextViewbeing removed from the view hierarchy ? - If so could you
resignFirstResponderbefore removing it from the super view.
If UITextView subclass is being used:
- Are you using a subclass of
UITextView, if so have you implementedcanResignFirstResponderto returnfalse. - Could you try returning
trueinstead.
0 comments:
Post a Comment