2012-07-05 26 views

回答

1

与此代码尝试:

if([view.layer repondsToSelector:@selector(removeAllAnimations)]) //Check if the CALayer responds to removeAllAnimations method for iOS4+ 
    [view.layer removeAllAnimations]; 
else 
    [view.layer addAnimation:nil forKey:@"TheKeyOfTheAnimation"]; // Change TheKeyOfTheAnimation with key you have added animation for, you can also use nil for the key... 

UPDATE:按照文档removeAllAnimations可用自iOS2.0以来 removeAllAnimations 删除所有连接到动画接收器。

- (void)removeAllAnimations 
Availability 
Available in iOS 2.0 and later. 
Declared In 
CALayer.h 
+0

Xcode直到我添加QuartzCore.framework才看到图层属性,如果我将QuartzCore.framework添加到库作为可选项并使用它,它会工作吗? –

+0

没有理由将它添加为可选项,因为它自ios2.0以来就受到支持,所以不会有没有它的设备... – graver

+0

谢谢你....) –