【发布时间】:2010-05-17 22:12:30
【问题描述】:
如果我实现 CALayer 委托方法 actionForLayer:forKey,我可以返回 [NSNull null] 以强制 CALayer 不对任何更改进行动画处理。不幸的是,[NSNull null] 没有实现 CAAction 委托,XCode 会发出以下警告:
警告:“NSNull”类未实现“CAAction”协议
方法代码如下:
- (id<CAAction>)actionForLayer:(CALayer *)theLayer
forKey:(NSString *)theKey {
//This disables the animations when moving things around
//Also, don't animate the selection box. It was doing weird things
if(undoGroupStarted || theLayer == self.selectionBox) {
return [NSNull null];
} else {
return nil;
}
}
我做错了吗?是否返回 [NSNull null] 不良行为?如果是这样,还有什么方法可以做我在这里尝试做的事情?如果没有,如何让编译器满意?
【问题讨论】:
标签: objective-c iphone xcode delegates calayer