I'm making a custom keyboard extension in Objective-C for iOS 15+.
Originally I designed myCustomInputView
and put all my keyboard stuff into it, using constraints for everything. I then would add it as a subview like this:
[myCustomKeyboardVC.inputView addSubview:myCustomInputView]
and then contain it to .inputView
.
That mostly worked fine, except that after making and dismissing several I had a bunch of myCustomInputView
objects remaining, being referenced by _inputViewContent
which isn't being used by a custom keyboard anymore.
I saw a suggestion that I should do this instead:
myCustomKeyboardVC.inputView = myCustomInputView
so that myCustomInputView
is assigned directly to the VC's .inputView
rather than being a subview of it.
But this has problems because I now don't know what to constrain it to, and it runs wider than the screen. (ie, how do I constrain myCustomInputView
to the keyboard width)?
So I guess my basic question is: must custom UIInputView
s be assigned directly to .inputView
or can they be a subview of it?