I have an animation that works fine in iOS 8 but not in iOS 7. In fact, it seems that sometimes, parts of the block are animated and parts are not (or maybe for different animation durations). It's quite hard to explain this.
__block BTQMenuItemView *previousToClose = nil;
[UIView animateWithDuration:(animated ? 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];