I need to be able to make a multi-line label in swift 2 sprite-kit for a game. The text needs to wrap around rather than go off of the screen. Bellow is what I have but I do not know what to do
import Foundation
import UIKit
import SpriteKit
class JDQuotes: SKLabelNode {
var number = 0
init(num: Int) {
super.init()
if num == 1 {
text = "\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. laborum.\""
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Starting iOS 11, this finally becomes possible with
SKLabelNode
:There is a Github solution over here as SKLabelNodes do not support multiple lines.
Code quoted:
EDIT: You might as well check this version too as it's updated for Swift2