UIView.animateWithDuration的延迟似乎没有延迟

时间:2015-06-12 10:44:55

标签: ios objective-c uiview core-animation

我想知道为什么延迟属性不起作用?

- (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);
   }];
}

这很奇怪。

有什么想法吗?

更新:

我从这堂课REDActionSheet.m

中取得了它

0 个答案:

没有答案