ios - Trouble passing data between scenes when I segue -


i've done tutorials pass data through scenes prepareforsegue:sender: method, right when try use passed data, it's null. i'm using navigation controller well.

here's .h -

#import <uikit/uikit.h>  #import "talkchattableviewcontroller.h"  @interface createchattableviewcontroller : uiviewcontroller   @end 

here's .m

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {      if ([[segue identifier] isequaltostring:@"idseguemychatstochat"]){              talkchattableviewcontroller *tctvc = [segue destinationviewcontroller];              tctvc.chatobjectid = @"test";              nslog(@"%@", tctvc.chatobjectid);              //succesfully logs out test           } } 

when log in above method, comes out fine. when go talkchattableviewcontroller class doesn't log out in viewdidload; it's null.

the header looks this:

#import <uikit/uikit.h> @interface talkchattableviewcontroller : uitableviewcontroller @property (nonatomic) nsstring * chatobjectid; @end 

and .m -

#import "talkchattableviewcontroller.h"  @implementation talkchattableviewcontroller  - (void)viewdidload {     [super viewdidload];     nslog(@"%@", self.chatobjectid);    // logs null }  @end 

talkchattableviewcontroller * tctvc = (talkchattableviewcontroller *)[segue destinationviewcontroller]; 

this winded working.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -