NSNotificationCenter with respect to ViewWillAppear and ViewWillDisapper
问题 I have a simple viewController that I want to listen for UIKeyboardWillHideNotification . Therefore I have the following code: - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillBeHidden) name:UIKeyboardWillHideNotification object:nil]; } - (void) keyboardWillBeHidden { [self.scrollView setContentOffset:CGPointMake(0, 0) animated:YES]; } I'm trying to decide when to remove the