Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

henktade

macrumors newbie
Original poster
Jan 30, 2009
17
0
hi guys,

I am working on one project were one of my view controller connects to a server and parses string(which I done already and which I can see from the log file) then loads a new view. on the new views view controller I want to display the result which is brought from the server. what is the proper way of communicating this information to the other view?

I have like strings, arrays ...

tanks
 

henktade

macrumors newbie
Original poster
Jan 30, 2009
17
0
pass information from one object to another(additional info)

I have a one view called iFetch104ViewController which contains a textField and a button.

with a click of this button .. I push a navigation bar view controller called ResponceViewController as follows.

[[self navigationController] pushViewController:[[ResponceViewController alloc] init] animated:YES];

instead of the above code, I wanted to pass the content of the text field also to the new navigation controller. and I tried the following:


ResponceViewController *test = [[ResponceViewController alloc]init];

test.testStr = numberField.text;

//numberField is a text field on the iFetch104ViewController
//testStr is a NSString pointer defined in ResponceViewController

[[self navigationController] pushViewController: test animated:YES];


so the program crashes every when it execute:

test.testStr = numberField.text;

pls help.........:confused:
 

henktade

macrumors newbie
Original poster
Jan 30, 2009
17
0
missing accessor methods

Do you have accessor methods for testStr defined in ResponceViewController?

that was exactly my problem. I come back to let u guys that I found the problem but tank you dejo for the replay.

I missed
@synthesize testStr;

in ResponceViewController.m
 

iphonejudy

macrumors 6502
Sep 12, 2008
301
1
I have a one view called iFetch104ViewController which contains a textField and a button.

with a click of this button .. I push a navigation bar view controller called ResponceViewController as follows.

[[self navigationController] pushViewController:[[ResponceViewController alloc] init] animated:YES];

instead of the above code, I wanted to pass the content of the text field also to the new navigation controller. and I tried the following:


ResponceViewController *test = [[ResponceViewController alloc]init];

test.testStr = numberField.text;

//numberField is a text field on the iFetch104ViewController
//testStr is a NSString pointer defined in ResponceViewController

[[self navigationController] pushViewController: test animated:YES];




I am also having same problem.

I am having a variable storyLink in Rootviewcontroller class.
I want the result of storyLink in Testviewcontroller class.

So i use the below code,
Rootviewcontroller *rootviewcontroller1 = [[Rootviewcontroller alloc]init];
Testviewcontroller *testviewcontroller1 = [[Testviewcontroller alloc]init];
testviewcontroller1.test=rootviewcontroller1.storyLink;
//test is a string variable of Testviewcontroller


NSLog(@"Test View Controller link: %@",test);

In test i got null value.
Can you please tell me the solution?
 

iphonejudy

macrumors 6502
Sep 12, 2008
301
1
I just saw this thread,

Actualy i try to send personaly to that guy.

ok.leave it.


Do u know the solution of my pblm?
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Do u know the solution of my pblm?
I do. You need to give storyLink a value before you reference it.

Like so:
Rootviewcontroller *rootviewcontroller1 = [[Rootviewcontroller alloc]init];
rootviewcontroller1.storyLink = @"a non-nil value";
Testviewcontroller *testviewcontroller1 = [[Testviewcontroller alloc]init];
testviewcontroller1.test=rootviewcontroller1.storyLink;
 

iphonejudy

macrumors 6502
Sep 12, 2008
301
1
I do. You need to give storyLink a value before you reference it.

Like so:
Rootviewcontroller *rootviewcontroller1 = [[Rootviewcontroller alloc]init];
rootviewcontroller1.storyLink = @"a non-nil value";
Testviewcontroller *testviewcontroller1 = [[Testviewcontroller alloc]init];
testviewcontroller1.test=rootviewcontroller1.storyLink;

I think u didnt understand my pblm.
Anyway i solved it.thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.