iphone - How to pass data between two ViewControllers without using segues and NaviagationController -


my problem it's when instance secondviewcontroller in firstviewcontroller assign value on variable id, problem can not use segue , naviagtiocontroller.. maybe solution use static variable?, how it, or tell me tip?

i code:

// in class firstviewcontroller.m #import "secondviewcontroller"  nsstring *identifier = [nsstring stringwithformat:@"%@", [self.cat objectatindex:indexpath.row]]; // start code causes error viewcontrollerone *instance = [[viewcontrollerone alloc]init]; instance.id = [[nsstring alloc] initwithformat:@"%@",identifier]; // end code causes error  // in secondviewcontroller.h     @property (nonatomic, retain) nsstring *id;  // in secondviewcontroller.m @synthesize id; 

the debug error:

2013-05-03 09:01:42.126 thefreeapp[19880:c07] * terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'uicollectionview must initialized non-nil layout parameter' * first throw call stack: (0x1cbc012 0x10f9e7e 0x1cbbdeb 0x53d748 0x558b1b 0x558646 0x11eff8 0x11f232 0x5588d5 0xbf5b 0x11ce1e 0xb74e 0xed285 0xed4ed 0xaf75b3 0x1c7b376 0x1c7ae06 0x1c62a82 0x1c61f44 0x1c61e1b 0x1c167e3 0x1c16668 0x3dffc 0x2bcd 0x2af5) libc++abi.dylib: terminate called throwing exception (lldb)

try this

[[nsuserdefaults standarduserdefaults]setvalue:yourval forkey:@"myvalue"]; nsstring *myval = [[nsuserdefaults standarduserdefaults]valueforkey:@"myvalue"]; 

hope helped


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -