Objective c 目标C:setCenterRect在运行时在alpha=0的sprite上崩溃

Objective c 目标C:setCenterRect在运行时在alpha=0的sprite上崩溃,objective-c,sprite-kit,alpha,cgrectmake,Objective C,Sprite Kit,Alpha,Cgrectmake,我不知道这是不是一个已知的错误。 如果我尝试在alpha=0的精灵中使用setCenterRect设置中心矩形尺寸,XCode将在运行时使用以下命令进行压碎: 线程1:EXC\u错误访问(代码=1,地址=0x0)。未提供其他警告或错误。 如果我在我的设备上运行应用程序(与Xcode断开连接),应用程序也会在启动时崩溃 这是我的代码: node = [SKSpriteNode spriteNodeWithImageNamed:@"sprite"]; node.anchorPoint = CGPoi

我不知道这是不是一个已知的错误。 如果我尝试在alpha=0的精灵中使用setCenterRect设置中心矩形尺寸,XCode将在运行时使用以下命令进行压碎: 线程1:EXC\u错误访问(代码=1,地址=0x0)。未提供其他警告或错误。 如果我在我的设备上运行应用程序(与Xcode断开连接),应用程序也会在启动时崩溃

这是我的代码:

node = [SKSpriteNode spriteNodeWithImageNamed:@"sprite"];
node.anchorPoint = CGPointMake(0.5,1.0);
node.position = CGPointMake(35,110);
node.zPosition = 100;
node.alpha = 0.0; // Make sprite invisible
[node setCenterRect:CGRectMake(0,0.35,1,0.4)];
[parentNode addChild:node];
如果我将alpha设置为非常低的数字,问题就会消失:
node.alpha=0.01

尝试
node.hidden=YES
?这也很有效。YES。非常感谢你的帮助。我不知道为什么在设置alpha值和centerRect之间会有冲突。但是使用隐藏属性可以绕过这个问题。再次感谢。