Abh*_*sad 4 objective-c cocos2d-iphone ios xcode5
我在cocos2dv3中的项目正在抛出ARC Sematic 问题
多个名为'setRotation:'的方法在归档(发布模式)时发现了不匹配的结果,参数类型或属性.它在部署到模拟器/设备(调试模式)时运行良好.在发布模式下,编译器在UIRotationGestureRecognizer
和中的旋转实现之间混淆CCNode
.当我收到错误时CCBAnimationManager.m
,我将调用选择器setRotation的对象类型化为(CCNode
*),但随后出现了错误CCActionInterval
.我希望有一个更好的解决方案,而不是在cocos2d库中进行类型转换.
我究竟做错了什么?感谢您的时间.
编辑
@interface CCAction : NSObject <NSCopying> {
id __unsafe_unretained _originalTarget;
id __unsafe_unretained _target;
NSInteger _tag;
}
@property (nonatomic,readonly,unsafe_unretained) id target;
@property (nonatomic,readonly,unsafe_unretained) id originalTarget;
@property (nonatomic,readwrite,assign) NSInteger tag;
Run Code Online (Sandbox Code Playgroud)
在
CCAction.m
@synthesize tag = _tag, target = _target, originalTarget = _originalTarget;
-(void) startWithTarget:(id)aTarget
{
_originalTarget = _target = aTarget;
}
-(void) startWithTarget:(id)aTarget
{
_originalTarget = _target = aTarget;
}
Run Code Online (Sandbox Code Playgroud)
类层次结构
@interface CCActionFiniteTime : CCAction <NSCopying>
@interface CCActionInterval: CCActionFiniteTime <NSCopying>
@interface CCBRotateTo : CCActionInterval <NSCopying>
CCBRotateTo.m {
-(void) startWithTarget:(CCNode *)aTarget
{
[super startWithTarget:aTarget];
startAngle_ = [self.target rotation];
diffAngle_ = dstAngle_ - startAngle_;
}
-(void) update: (CCTime) t
{
[self.target setRotation: startAngle_ + diffAngle_ * t];
}
}
Run Code Online (Sandbox Code Playgroud)
这个问题让我头疼不已.虽然我已经为我的旧项目将cocos2d升级到v2.2版本(太复杂而无法更新到v3),但我仍然收到了此警告.我创建的任何动画在SpriteBuilder中使用旋转确实很奇怪,正如我在这里描述的那样: iPhone5S上的旋转动画问题与cocos2d 2.0
最后我使用类型转换来解决它在CCBAnimationManager.m中的跟随
@implementation CCBRotateTo
-(void)startWithTarget:(CCNode *)aTarget
{
[super startWithTarget:aTarget];
starAngle_ = [(CCNode *)self.target rotation];
diffAngle_ = dstAngle_ - startAngle_;
}
-(void)update:(ccTime)t
{
[(CCNode *)self.target setRotation: startAngle_ + diffAngle_ * t];
}
Run Code Online (Sandbox Code Playgroud)
有了这个改变,现在我也可以支持arm64了.
归档时间: |
|
查看次数: |
2889 次 |
最近记录: |