来自NSAnimationContext的NSAnimationContext方法不适合我。我正在使用Apple文档中的代码:
[NSAnimationContext setCompletionHandler:^{
// This block will be invoked when all of the animations
// started below have completed or been cancelled.
NSLog(@"All done!");我有以下错误:没有已知的选择器'setCompletionHandler:‘类方法
当我查看这个方法旁边的NSAnimationContext.h文件时,会看到#if NS_BLOCKS_AVAILABLE和NS_AVAILABLE_MAC(10_7)。我的部署目标是"10.7",但是我不知道如何检查NSBlocks是否可用。或者问题就在其他方面?
发布于 2014-05-14 21:16:38
文档中的示例代码有一个错误。-setCompletionHandler:方法是实例方法,而不是类方法。您需要在[NSAnimationContext currentContext]上调用它,而不是在类本身上调用:
[[NSAnimationContext currentContext] setCompletionHandler:^{
// This block will be invoked when all of the animations
// started below have completed or been cancelled.
NSLog(@"All done!");
}];https://stackoverflow.com/questions/23664916
复制相似问题