在我的Sprite Kit游戏中,我使用了几个SKLabelNodes ..其中大部分是我运行SKActions。在各种iOS模拟器和设备(iPhone 6)上一切正常。但! ..所有Testflight设备(包括一些iPhone 6)一个标签永远不会出现!
怎么可能?
答案 0 :(得分:1)
我建议设置SKLabelNode的.visible-xs-portrait,
.visible-xs-landscape {
display: none !important;
}
.visible-xs-portrait{
@media (max-width: @screen-xs-max) and (orientation:portrait) {
display: block;
}
}
.visible-xs-landscape{
@media (max-width: @screen-xs-max) and (orientation:landscape) {
display: block;
}
}
属性,以及场景中的所有其他节点,并使用一些日志语句进行测试:
(假设你选择:.name
)
missingLabelNode.name = @"Missing";
确定之后,日志打印“缺少标签”..
// make sure the Label Node has been added to the scene
NSLog(@"%@ label", [self childNodeWithName:@"Missing"].name);
现在你应该确定它在场景中的坐标和存在。如果它是场景本身以外的节点的子节点,您还可以使用// Find the coordinates of the Label Node
NSLog(@"Located at X:%f Y:%f" [self childNodeWithName:@"Missing"].position.x, [self childNodeWithName:@"Missing"].position.y);
// If you've added it to a different layer of the scene, or another node
NSLog(@"Inside Parent:%@" [[self childNodeWithName:@"Missing"] parent].name);
并记录这些坐标来转换它的位置。
最后,如果你确定它应该在场景的视觉范围内,我会检查它的zPosition。丢失其他节点后面的节点非常容易。将zPosition属性增加到您设置的最高索引的属性。如果您尚未设置任何其他节点的zPosition,请使用[self convertPoint:missingLabelNode.position toNode:self]
将其置于节点层次结构的顶部。
这应该可以解决问题。