Klawiatura ukryj i pokaż ponownie zaraz po zwolnieniu UIActionSheet w iOS 7, SDK 7

TworzęUIActionSheet w moim ViewControllerze. Dodaję też kod do złapaniaUIKeyboardWillShowNotification iUIKeyboardWillHideNotification powiadomienie.

Moim problemem jestkiedy odprawiam, dostaję dwie ukryte klawisze powiadomień. Ktoś może mi pokazać, jak temu zapobiec? Dzieje się tak tylko w systemie iOS 7 i kompilacji za pomocą SDK 7

Zaktualizuj kod:

W viewDidLoad inicjuję przycisk, gdy przycisk dotykowy zostanie wyświetlony arkusz akcji.

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(10, 50, 100, 30);
    [button setTitle:@"Open menu" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonTouched) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

    UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
    [self.view addSubview:textView];
    [textView becomeFirstResponder];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillHide:)
                                                 name:UIKeyboardWillHideNotification
                                               object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillShow:)
                                                 name:UIKeyboardWillShowNotification
                                               object:nil];
}

- (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar{
    [searchBar resignFirstResponder];
}

- (void) buttonTouched{
    UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"Action sheet" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Destructive" otherButtonTitles:@"Hello", nil];
    [actionSheet showInView:self.view];
}

- (void)keyboardWillShow:(NSNotification*)notification{
    NSLog(@"keyboardWillShow");
}

- (void)keyboardWillHide:(NSNotification*)notification{
    NSLog(@"keyboardWillHide");
}

Używam aplikacji, pokaże się klawiatura, dotknę przycisk, pokazał się arkusz akcji. Odrzucam arkusz akcji przez dotknięcie dowolnego przycisku na nim, a wydruk dziennika:

keyboardWillShow

keyboardWillHide

keyboardWillShow

questionAnswers(2)

yourAnswerToTheQuestion