swift - How to add UIView on top of SKView? -
i wanted add custom nsview on top of , skview. however, never showing up. have no clue happening...
class gamescene: skscene { override func didmovetoview(view: skview) { //trying add custom view let smallview = nsview(frame: nsrect(origin:cgpoint(x: 100,y: 100), size: cgsize(width: 200, height: 200))) let layer = calayer() layer.backgroundcolor = cgcolorcreategenericrgb(1.0, 0.0, 0.0, 0.4) smallview.layer = layer view.superview!.addsubview(smallview) } }
could give me insight happening here? tried adding nslabels mainstory board. nothing happens.
i wanted draw thing coregrapghics , show on top of skscene.but, can't move forward.
try add uiview viewcontroller, instead of adding skscene. in vc add function (for example), create uiview, , add subview of view, so:
let myview = uiview(frame: cgrect(x: 0, y:0, width: 100, height: 100)) self.view.addsubview(myview)
it add new view above existing view, gamescene below new uiview.
Comments
Post a Comment