0
我需要带'trueName'的纹理加载到我的myImageViewOutlet.image中。我得到的结果是整个图集渲染到它。我的代码如下UImage加载整个SKTextureAtlas而不仅仅是SKTexture
let myTextureAtlas = SKTextureAtlas.init(named: "myGameTextures")
// let texture = myTextureAtlas.textureNamed(trueName) // will render the entire atlas, instead of just the texture by trueName
let texture = myTextureAtlas.textureNamed(trueName+”bad name“) // will produce the placeholder image by sprite kit by itself just fine, but it's not the one I want obviously
let image = texture.CGImage()
let newImage = UIImage(CGImage: image, scale: 1.0, orientation: UIImageOrientation.Up)
// let newImage = UIImage(CGImage: image) // .. the straight forward way
myImageViewOutlet.image = newImage