1 year ago

#138405

test-img

danTheMan

Change Letterbox Color

I have a SKScene which I am Using aspectFit scaleMode because I want use this scene across multiple devices. Is there any way to change the letterbox color to transparent?

This is the result of my code

field!.scaleMode = .aspectFit
field?.view?.contentMode = .scaleAspectFit 
field?.view?.backgroundColor = .clear
    field?.backgroundColor = .clear
    field?.view?.allowsTransparency = true
    fv.contentMode = .scaleAspectFit
    fv.superview?.backgroundColor = .clear
    fv.scene?.backgroundColor = .clear
    fv.allowsTransparency = true
    fv.backgroundColor = .clear
    fv.showsFPS = false
    fv.showsNodeCount = false
    fv.ignoresSiblingOrder = false
    fv.presentScene(field)

Field is the SKScene and fv is the SKView which presents the scene.

swift

sprite-kit

skscene

skview

0 Answers

Your Answer

Accepted video resources