swift - UILabel does not appear on SKScene -


i trying create label on skscene not appearing. don't know wrong. code seems fine:

class end: skscene {      var label = uilabel()      override func didmovetoview(view: skview) {         scene?.backgroundcolor = uicolor(red: cgfloat(59.0/255.0), green: cgfloat(89.0/255.0), blue: cgfloat(152.0/255.0), alpha: cgfloat(1.0))           label.text = "game over!"          label.backgroundcolor = uicolor.blackcolor()          label = uilabel(frame: cgrect(x: 0, y: 0, width: view.frame.width/3, height: 30))          label.center = cgpoint(x: view.frame.size.width / 2, y: view.frame.size.width/7)          label.textcolor = uicolor.whitecolor()          self.view?.addsubview(label)           } } 

the problem have set textcolor , backgroundcolor both whitecolor(), change 1 show text properly.

edit:

i think want add label inside view passing parameter use view.addsubview(label) instead of self.view?.addsubview(label).


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -