Skip to content

Commit 5655cf4

Browse files
Merge pull request #61 from bill350/master
Add fading animation for OverlayView by bill350
2 parents 0d04bac + 8324ee6 commit 5655cf4

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

WYPopoverController/WYPopoverController.m

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,7 @@ - (void)presentPopoverFromRect:(CGRect)aRect
16131613
{
16141614
if ((options & WYPopoverAnimationOptionFade) == WYPopoverAnimationOptionFade)
16151615
{
1616+
overlayView.alpha = 0;
16161617
containerView.alpha = 0;
16171618
}
16181619

@@ -1626,6 +1627,8 @@ - (void)presentPopoverFromRect:(CGRect)aRect
16261627
}
16271628

16281629
[UIView animateWithDuration:WY_POPOVER_DEFAULT_ANIMATION_DURATION animations:^{
1630+
overlayView.alpha = 1;
1631+
overlayView.transform = CGAffineTransformIdentity;
16291632
containerView.alpha = 1;
16301633
containerView.transform = CGAffineTransformIdentity;
16311634
} completion:^(BOOL finished) {
@@ -2027,8 +2030,20 @@ - (void)dismissPopoverAnimated:(BOOL)aAnimated callDelegate:(BOOL)callDelegate
20272030

20282031
completionBlock = ^(BOOL finished) {
20292032

2030-
[overlayView removeFromSuperview];
2031-
overlayView = nil;
2033+
if (aAnimated)
2034+
{
2035+
[UIView animateWithDuration:WY_POPOVER_DEFAULT_ANIMATION_DURATION animations:^{
2036+
overlayView.alpha = 0;
2037+
} completion:^(BOOL finished) {
2038+
[overlayView removeFromSuperview];
2039+
overlayView = nil;
2040+
}];
2041+
}
2042+
else
2043+
{
2044+
[overlayView removeFromSuperview];
2045+
overlayView = nil;
2046+
}
20322047

20332048
if ([viewController isKindOfClass:[UINavigationController class]] == NO)
20342049
{

0 commit comments

Comments
 (0)