ios - prepareForSegue() and viewDidLoad() of SecondViewController -
prepareforsegue() method defines object type of secondviewcontroller. then, access data member of secondviewcontroller class , assign "new view controller" string data member. of things performed in prepareforsegue() method.
is viewdidload() method of secondviewcontroller class invoked after prepareforsegue() method of mainviewcontroller class ?
i asked question because prepareforsegue() initialize data member declared string type of secondviewcontroller class. if asked above true, can assign string member label.text of secondviewcontroller class.
in prepareforsegue
accessing secondviewcontroller
trigger viewdidload
.
it quite obvious if think it, need have view loaded access it.
you can still use other view lifecycle method in secondviewcontroller
viewwillappear
or create custom init
it.
Comments
Post a Comment