swift - How to access a method in SKScene From UIViewController -
i show uialertcontroller() using nsnotificationcenter skscene.
then when 1 of options clicked execute method in skscene(). method add node, if use
let s = gamescene() s.methodname() this doesnt use current reference, creat new scene , node not added
if pass scene when sending notification so
nsnotificationcenter.defaultcenter().postnotificationname("detectnot", object: self); after given option chosen , method execute gives error, there no info error
send notification this
nsnotificationcenter.defaultcenter().postnotificationname("detectnot", object: self); in uiviewcontroller method
let _scene = notification.object as! gamescene then can access method
Comments
Post a Comment