Take the 2-minute tour ×  I am using the following
NSNotifications within a UIView so that the view can be notified
when a UIKeyboard appears and adjust its position (frame) on
screen:   The two notifications above are being subscribed to
within the -init method of the UIView. Where is the best place
to unsubscribe from these notifications once the view has
disappeared off-screen? At the moment the app is crashing
whenever the UIKeyboard appears in another view, presumably
because a notification is still being sent to the then released
UIView.  Also, is there a better place to be subscribing to the
notifications, apart from within the -init method?  Thanks for
any assistance.  share|improve this question add comment  7
Answers  up vote 10 down vote accepted  -[UIView
willMoveToWindow:] and -[UIView didMoveToWindow] are called even
when a view is removed from a window. The window argument (or
the window property in the case of -didMoveToWindow) will be nil
in that case, i. e.:  - (void)willMoveToWindow:(UIWind