如何使用 Spritekit 使不同的对象与 IPhone 和 IPad 兼容

How to make different objects compatible with IPhone and IPad using Spritekit

所以我一直在尝试通过使用基于屏幕尺寸的比例使我的所有对象都适合 IPad 和 IPhone 的正确尺寸。但是我在使用诸如 SKLabelNode 之类的对象时遇到了麻烦,因为它使用 fontSize 而不是 (width, height) 格式。假设我想在 IPhone 6 上制作 fontSize 35 的 SKLabelNode,我将如何使用比例使其相对于 IPad 2 的屏幕大小相同,以便它适用于 IPhone 和 IPad?

    SKLabelNode *myLabel2;
    myLabel2 = [SKLabelNode labelNodeWithFontNamed:@"HelveticaNeue-Light"];
    myLabel2.text=@"Click";
    myLabel2.fontSize = 35;

不可能

The frame property provides the bounding rectangle for a node’s visual content, modified by the scale and rotation properties. The frame is non-empty if the node’s class draws content. Each node subclass determines the size of this content differently. In some subclasses, the size of the node’s content is declared explicitly, such as in the SKSpriteNode class. In other subclasses, the content size is calculated implicitly by the class using other object properties. For example, an SKLabelNode object determines its content size using the label’s message text and font characteristics.