我已经建立了一个简约的项目这里,它只是添加了一个红色方块,并-点击屏幕-一个光源照亮它。在模拟器上,它运行得很好,但是在我的iPhone 5上,当光源被添加到节点树时,这个方块就变得不可见了。
有人能在其他真实的设备上进行测试并给出反馈吗?有什么解决办法吗?快把我逼疯了。
这是现场的代码:
SKLightNode* lightNode;
@implementation GameScene
-(void)didMoveToView:(SKView *)view {
//Add some node to be lit
SKSpriteNode* node = [SKSpriteNode spriteNodeWithColor:[UIColor redColor] size:CGSizeMake(100, 100)];
node.position = CGPointMake(self.size.width/2.0, self.size.height/2.0);
node.lightingBitMask = 1;
[self addChild:node];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
//Add a light node to light the object
if (!lightNode) {
lightNode = [SKLightNode node];
lightNode.categoryBitMask = 1;
[self addChild:lightNode];
}
lightNode.position = [((UITouch*)[touches anyObject]) locationInNode:self];
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
lightNode.position = [((UITouch*)[touches anyObject]) locationInNode:self];
}
@end发布于 2014-09-30 08:40:25
iOS8中似乎有一个bug。我也经历过同样的问题,并向苹果公司发送了一个bugreport。SKLightNode在iPhone5上似乎不能很好地工作。我试过iPhone6 (ok)、iPhone5s (ok)、iPhone5 (不工作-黑屏)、iPod5 (ok)、iPad Mini Retina (ok)、ipad2 (ok)。
https://stackoverflow.com/questions/25912880
复制相似问题