UIView.animateWithDuration's Delay does not seem to delay

89 views Asked by At

I am wondering why is the delay property does not work?

- (void)showButtons
{
    CGFloat buttonContainerLastYCoor = CGRectGetHeight(self.frame) - (CGRectGetHeight(self.buttonsContainerView.frame) + CGRectGetHeight(self.cancelButton.frame) + (REDActionSheetCancelButtonMargin * 2.0));

    [UIView animateWithDuration:REDShowAnimationDuration delay:0.0 usingSpringWithDamping:REDAnimationSpringDamping initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        self.maskBackgroundView.alpha = 0.50;
        self.backgroundView.transform = CGAffineTransformMakeScale(0.90, 0.90);

    CGRect frame = self.buttonsContainerView.frame;
    frame.origin.y = buttonContainerLastYCoor;
    self.buttonsContainerView.frame = frame;
    } completion:^(BOOL finished) {

    }];

    /**********THIS ANIMATION BELOW IS NEVER DELAYED**********/
    CGFloat cancelButtonLastYCoor = CGRectGetHeight(self.frame) - (CGRectGetHeight(self.cancelButton.frame) + REDActionSheetCancelButtonMargin);

    [UIView animateWithDuration:REDShowAnimationDuration delay:5.0 usingSpringWithDamping:REDAnimationSpringDamping initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        CGRect frame = self.cancelButton.frame;
        frame.origin.y = cancelButtonLastYCoor;
        self.cancelButton.frame = frame;
   } completion:^(BOOL finished) {
        if (self.actionSheetDidPresentBlock)
        self.actionSheetDidPresentBlock(self);
   }];
}

This is weird.

Any ideas?

UPDATE:

I took it from this class REDActionSheet.m

0

There are 0 answers