Ios UIView.animateWithDuration';s的延迟似乎并不延迟
我想知道为什么延迟属性不起作用Ios UIView.animateWithDuration';s的延迟似乎并不延迟,ios,objective-c,uiview,core-animation,Ios,Objective C,Uiview,Core Animation,我想知道为什么延迟属性不起作用 - (void)showButtons { CGFloat buttonContainerLastYCoor = CGRectGetHeight(self.frame) - (CGRectGetHeight(self.buttonsContainerView.frame) + CGRectGetHeight(self.cancelButton.frame) + (REDActionSheetCancelButtonMargin * 2.0));
- (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);
}];
}
这很奇怪
有什么想法吗
更新:
我是从这门课上拿的按钮被点击了吗被叫了两次?对不起@johnpatrickmorgan。我粘贴了错误的代码。请看更新的问题。第二个动画块从来没有这样的延迟。你在使用自动布局吗?如果是这样,您应该为自动布局约束的更改设置动画,而不是操纵视图的布局frames@DuncanC不,我不是。