UIView.animateWithDuration Delay does not delay

I am wondering why the delay property is not working?

- (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 strange.

Any ideas?

UPDATE:

I took it from this REDActionSheet.m class

+3


source to share





All Articles