I have a custom View (NotifyView
) added on UIWindow
with a dismiss button(which remove it from UIWindow
).
This view is added when a PUSH notification comes in didReceiveRemoteNotification
there are several cases when I could be on any screen, and my keyboard is UP via UITextfield
/UITextview
.
At this stage if a push comes, the NotifyView
is added on UIWindow
behind the keyboard.
I want to resign the keyboard once the PUSH is received so for that I could:
post a Notification with
NSNotificaitonCenter
to resign all textfields/textviews (if anyone isfirstResponder
). For this I have to keep active pointer to the currently active textfield/textview in all controllers.make a variable in AppDelegate and assign the active textfields/textviews to it and on PUSH, and
resignFirstResponder
of those on PUSH.
Both of the solutions would require making changes to all controller's code and I am looking for something more generic like:
- could there be any way through which I could simply remove the Keyboard from the screen on receiving PUSH
- or I could fetch the current firstResponder of the application and resign it explicitly.
these could be generic solutions.
It would be really helpful if someone could facilitate this thought process or someone have any immediate solution for this case.