ios - why parentViewController, presentingViewController and PresentedViewController are always nil -


i have simple app several viewcontrollers need know vc come when in vc (except first one). vcs created in storyboard , navigate through vcs code below :

class firstvc: uiviewcontroller {         func showstartvc()     {         if gfirststart         {             let vc = self.storyboard!.instantiateviewcontrollerwithidentifier("evaluserlevelvc") evaluserlevelvc             self.presentviewcontroller(vc, animated: false, completion: nil)         }         else         {             let vc = self.storyboard!.instantiateviewcontrollerwithidentifier("choixlevelvc") choixlevelvc             self.presentviewcontroller(vc, animated: true, completion: nil)         }     }      func showprefsvc()     {         let vc = self.storyboard!.instantiateviewcontrollerwithidentifier("prefsvc") prefsvc         self.presentviewcontroller(vc, animated: true, completion: nil)     } }   class firstvcsceneclass: skscene {     var vcfirst = firstvc?()      override func touchesbegan(touches: nsset, withevent event: uievent)     {             touch: anyobject in touches         {             let location = touch.locationinnode(self)              switch self.nodeatpoint(location).name!             {             case "start":                 vcfirst?.showstartvc()                 self.paused = true              case "preferences":                 vcfirst?.showprefsvc()                 self.paused = true              default:                 break             }         }     } } 

in code above "choixlevelvc" can called here , vc (exactly same way) , need know vc has been called. understanding property "presentingviewcontroller" should have information when access "choixlevelvc" uiviewcontroller class

but if put below code in "choixlevelvc" @ nil although expect find "firstvc" in property "presentingviewcontroller"

class choixlevelvc: uiviewcontroller, uicollectionviewdelegateflowlayout, uicollectionviewdatasource {     override func viewdidload()     {         println("parentviewcontroller : \(self.parentviewcontroller)")         println("presentingviewcontroller : \(self.presentingviewcontroller)")         println("presentedviewcontroller : \(self.presentedviewcontroller)")     } } 

and same in every vc. there need in order have these properties correctly set ?


Comments