Sorry for letting you wait, Nikita! Im a bit ill currently, so yesterday I was too drowsy to reply.
Yes, basically the KeyboardEventDictionary is what you are looking for. Wow, I even forgot I created one!
Looks like youre on a good path. In case others are looking for this solution too, here a rather lengthy explanation:
It would probably be better to subclass iOSLibTextField so that each textfield gets the notifications itself. It should only react if it is the current responder. I am lacking a bit of focus myself today, but Ill try to extend the class ASAP.
If you want to try: Youll find examples on how to use the SharedNotificationCenter to install block methods throughout the library. An example is AppleWindow/AttachNotificationCenter. Basically, you register the Notification name and the AppleBlock that should fire when the notification occurs. The register method delivers a handle a NotificationObject , that you should buffer and use to deregister when the control closes.
As an example:
Give your textfield subclass a Property NotificationObjects() As AppleNotificationObject
In your constructor, add a similar method like the AttachNotificationCenter method from AppleWindow after super.constructor.
In this method, you should register each Keyboard notification (see AppleWindow again where the notification names are constants), for example:
Dim WillShowBlock As new appleBlock (addressOf YourMethodThatshouldFireWhenKeyboardShows)
NotificationObjects.Append AppleNotificationCenter.addObserver ("UIKeyboardWillShowNotification", me, AppleOperationQueue.MainQueue, WillShowBlock)
YourMethodThatshouldFireWhenKeyboardShows must be a method that takes a Ptr as input value, and as first action it should convert the ptr to an AppleNotification. Lets say you named the input ptr simply p:
Dim Notification As New AppleNotification(p)
Dim userDict as iOSLibKeyboardEventDictionary = iOSLibKeyboardEventDictionary.MakeFromPtr(notification.UserInfo.id)
BeginFrame and EndFrame will give you the NSRects of the keyboard.
Do so with all the Keyboard notifications you want to handle. WillShow and WillHide or DidHide should be the most relevant ones.
When the control closes, iterate over the NotificationObjects:
AppleNotificationCenter.RemoveObserver (currentObject)
There is no need to install AppleNotificationCenter or create it. It is a soliton that creates itself once it is called.