Closed benjaminhorner closed 8 years ago
@benjaminhorner: Did you try setting editableTextNode.textView.inputAccessoryView = ? It does not matter that the textView is read only, because you are not trying to change the textView property. Instead, the inputAccessoryView property on the textView object is declared as readwrite.
@hannahmbanana: Indeed this works. I don't know why, when I first tested it I had problems with the placeholder text…
I am trying to implement 2 distinct inputAccessoryViews for 2 distinct ASEditableTextNodes and I have almost successfully managed… but for one little detail: when I hit any of the system buttons, my logic gets messed up, and here is why.
After unsuccessfully trying to attach the inputAccessoryView to each ASEditableTextNode view (impossible because it is a read-only variable that needs to be overriden in order to be read-write), I decided to override the inputAccessoryView of the ASViewController (as it inherits from UIViewController) and set a boolean in it to determine which inputAccessoryView should be shown.
The boolean is updated via a delegate called in
editableTextNodeDidBeginEditing(editableTextNode: ASEditableTextNode)
in the child Node… except that it is updated AFTER the inputAccessoryView is set.Everything works fine however, if I take this into consideration until… I press a system button.
Since I am using the ASViewController's inputAccessoryView instead of the one for each ASEditableTextNode view, I cannot call reloadInputViews() on the ASEditableTextNode views and reload the inputAccessoryViews to get the correct one.
I suppose the easy solution is to add
override var inputAccessoryView: UIView?
(sorry this is Swift) to the ASEditableTextNode View directly in AsyncDisplayKit…Any other suggestions ?