Skip to content

Commit

Permalink
Merge pull request gpambrozio#25 from natanrolnik/master
Browse files Browse the repository at this point in the history
Improved reliability to BlockTextpromptAlertView
  • Loading branch information
gpambrozio committed May 20, 2012
2 parents 4999c4a + c3797b7 commit e3276bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion BlockAlertsDemo/ToAddToYourProjects/BlockAlertView.m
Expand Up @@ -285,7 +285,9 @@ - (void)show
center.y -= kAlertViewBounce;
_view.center = center;
}
completion:nil];
completion:^(BOOL finished) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"AlertViewFinishedAnimations" object:nil];
}];
}];

[self retain];
Expand Down
Expand Up @@ -83,12 +83,13 @@ - (void)show {

[super show];

[self.textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.5];
[[NSNotificationCenter defaultCenter] addObserver:textField selector:@selector(becomeFirstResponder) name:@"AlertViewFinishedAnimations" object:nil];
}

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated {
[super dismissWithClickedButtonIndex:buttonIndex animated:animated];

[[NSNotificationCenter defaultCenter] removeObserver:textField];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
}

Expand Down

0 comments on commit e3276bf

Please sign in to comment.