我有一个动画,在ios 8中运行良好,但在ios 7中没有。事实上,似乎有时块的一部分是动画的,而另一部分不是(或者可能是不同的动画持续时间)。这很难解释。
__block BTQMenuItemView *previousToClose = nil;
[UIView animateWithDurationanimated ? kAnimationDuration : 0.f) animations:^{
[_menuItemViews enumerateObjectsUsingBlock:^(BTQMenuItemView *current, NSUInteger idx, BOOL *stop) {
BTQMenuItemView *previous = (idx > 0 ? _menuItemViews[idx-1] : nil);
if(previous.expanded && sender == previous) {
current.top = current.savedFrame.origin.y + sender.item.contentView.height + (sender.item.titleView ? sender.item.titleView.height - sender.height : 0) + sender.item.marginTopContent;
sender.height += sender.item.contentView.height;
sender.height += sender.item.titleView.height;
sender.item.contentView.top = (sender.item.titleView ? sender.item.titleView.bottom : sender.titleLabel.bottom) + sender.item.marginTopContent;
sender.actionView.height += (sender.item.titleView ? sender.item.titleView.height - sender.actionView.height : 0);
} else {
if(previous.expanded) {
previous.height = previous.savedFrame.size.height;
previous.actionView.height = previous.titleLabel.height;
previous.expanded = NO;
previousToClose = previous;
}
current.height = current.savedFrame.size.height;
current.top = previous.bottom;
}
}];
BTQMenuItemView *lastView = [_menuItemViews lastObject];
_bottomCacheView.height = self.superview.height - self.top - lastView.bottom - _edgeInsets.bottom;
_bottomCacheView.top = lastView.bottom;
} completion:^(BOOL finished) {
BTQMenuItemView *lastView = [_menuItemViews lastObject];
self.height = lastView.bottom;
}];
[previousToClose iconWillOpen:NO];
Best Answer-推荐答案 strong>
原来iOS8中的动画系统有些变化。这里解释得很好(第一个答案解决了我的问题)=>iOS 8 animation bug 你也可以阅读这篇文章。
关于ios - iOS 7上的动画问题,但iOS 8上没有,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/30728597/
|