objective c - Best practice for UIKeyboard notifications - iPhone SDK -


I have a drill down navigation app with three levels of UIViewControllers in each view controller, I have UITextField where I I'm trying to subclass the UIKeyboard. My question is, where "set" notifications are and "unset" them.

I have notifications:

  [[NSNotificationCenter defaultCenter] addObserver: self selector: @silator (keyboard game show :) name: UIKeyboardWillShowNotification object: zero]; [[NSNotificationCenter defaultCenter] addObserver: Self Selector: @Sylector (KeyboardDialHide :) Name: UIKeyboardWillHideNotification Object: Zero];  

Is it best to set it up in Visual Deedload event? Or viewWillAppear event

and similar to ? [[NSNotificationCenter defaultCenter] removeObserver: Self];

I do not want many to show the keyboard layout: Events are called as drill.

Many thanks, Brett

I recommend that you send them to Init and in dealloc methods, such as viewWillAppear and viewWillDisappear every time the view appears or disappears Becomes , which is unnecessary to cancel the notification / registration.


Comments