我正在尝试使用SKShapeNode绘制一个空矩形,但确实出现在屏幕上。如果我将颜色设置为填充属性,则会出现矩形。可能是什么问题?
// MyScene.h
#import <SpriteKit/SpriteKit.h>
@interface MyScene : SKScene
@end
// MyScene.m
#import "MyScene.h"
@implementation MyScene
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
SKShapeNode *shapeNode = [SKShapeNode shapeNodeWithRectOfSize:CGSizeMake(self.frame.size.width/2, self.frame.size.height/2)];
shapeNode.strokeColor = [SKColor redColor];
shapeNode.lineWidth = 3;
[self addChild:shapeNode];
}
return self;
}
@end