Skip to content

Commit e877aeb

Browse files
committed
Add slight bounce to alert view animation
1 parent 0c9ac2d commit e877aeb

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Classes/ios/FUIAlertView.m

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,24 @@ - (void)show {
156156
if ([self.delegate respondsToSelector:@selector(willPresentAlertView:)]) {
157157
[self.delegate willPresentAlertView:self];
158158
}
159-
[UIView animateWithDuration:self.animationDuration animations:^{
159+
[UIView animateWithDuration:self.animationDuration/1.5 animations:^{
160160
self.backgroundOverlay.alpha = 1.0f;
161-
self.alertContainer.transform = CGAffineTransformIdentity;
162-
} completion:^(BOOL finished) {
163-
_visible = YES;
164-
if ([self.delegate respondsToSelector:@selector(didPresentAlertView:)]) {
165-
[self.delegate didPresentAlertView:self];
166-
}
167-
}];
168-
161+
self.alertContainer.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);}
162+
completion:^(BOOL finished) {
163+
164+
[UIView animateWithDuration:self.animationDuration/2 animations:^{
165+
self.alertContainer.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);} completion:^(BOOL finished) {
166+
167+
[UIView animateWithDuration:self.animationDuration/2 animations:^{
168+
self.alertContainer.transform = CGAffineTransformIdentity;
169+
} completion:^(BOOL finished) {
170+
_visible = YES;
171+
if ([self.delegate respondsToSelector:@selector(didPresentAlertView:)]) {
172+
[self.delegate didPresentAlertView:self];
173+
}
174+
}];
175+
}];
176+
}];
169177
}
170178

171179
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex {

0 commit comments

Comments
 (0)