iOS 8上的MPVolumeView动画 [英] MPVolumeView animation on iOS 8

查看:129
本文介绍了iOS 8上的MPVolumeView动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆