In Xcode 6 Beta 4 stroking with SKShapeNode doesn't work anymore

流过昼夜 提交于 2020-01-02 05:45:21

问题


In Xcode 6 beta 2 it worked fine, but in beta 4 it doesn't work anymore. Does anyone know what's behind this mystery?

let circle = SKShapeNode(circleOfRadius: 125);
circle.strokeColor = UIColor(red: 255, green: 255, blue: 255, alpha: 1.0);
circle.lineWidth = 4
self.addChild(circle);

In beta 4 nothing can be seen.

Thanks for your help in advance.


回答1:


This is a common issue with Xcode 6 Beta 4 when using the simulator. It renders fine when using an actual device. See this developer forums thread. It is worth noting that the issue is exclusive to stroking in that setting circle.fillColor still fills the circle (or whatever your SKShapeNode is drawing) correctly.

Also keep in mind that when initializing a UIColor with RGB values the RGB values must be between (inclusive) 0.0 and 1.0.

circle.strokeColor = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0);

Or alternatively use the preset:

circle.strokeColor = UIColor.whiteColor()


来源:https://stackoverflow.com/questions/24951185/in-xcode-6-beta-4-stroking-with-skshapenode-doesnt-work-anymore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!