iOS 8上的MPVolumeView动画 [英] MPVolumeView animation on iOS 8
问题描述
在iOS 8中存在问题或功能。
当显示MPVolumeView时,它会被动画化,就像从0扩展到它的宽度一样。
我该如何解决这个问题?在iOS 7上没有这样的问题。
In iOS 8 there is a problem or a feature. When MPVolumeView is shown, it's being animated, like expanding from 0 to it's width. How can I fix that behavior? There was no such problem on iOS 7.
推荐答案
删除此行为的一种可能方法是继承MPVolumeView并执行一些额外的工作在 [super layoutSubviews]
之后。
One possible way to remove this behavior is to subclass MPVolumeView and perform some additional work after [super layoutSubviews]
.
- (void)layoutSubviews
{
[super layoutSubviews];
[self cg_recursiveRemoveAnimationsOnView:self];
}
- (void)cg_recursiveRemoveAnimationsOnView:(UIView *)view
{
[view.layer removeAllAnimations];
for (UIView *subview in view.subviews) {
[self cg_recursiveRemoveAnimationsOnView:subview];
}
}
这将删除所有插入的动画。所以要确保这就是你想要的,因为这太过分了。也可以删除位置
和边界
动画(参见 removeAnimationForKey:
)。
This removes all inserted animations. So be sure that is what you want, since this is quite the overkill. One could also just remove the position
and bounds
animations (see removeAnimationForKey:
).
这篇关于iOS 8上的MPVolumeView动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!