Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 26, 2009, 05:36 AM   #1
henktade
macrumors newbie
 
Join Date: Jan 2009
pass information from one object to another

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 is offline   0 Reply With Quote
Old Feb 26, 2009, 10:35 AM   #2
henktade
Thread Starter
macrumors newbie
 
Join Date: Jan 2009
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.........
henktade is offline   0 Reply With Quote
Old Feb 26, 2009, 11:21 AM   #3
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Do you have accessor methods for testStr defined in ResponceViewController?
dejo is offline   0 Reply With Quote
Old Feb 26, 2009, 01:16 PM   #4
henktade
Thread Starter
macrumors newbie
 
Join Date: Jan 2009
missing accessor methods

Quote:
Originally Posted by dejo View Post
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
henktade is offline   0 Reply With Quote
Old Feb 27, 2009, 12:51 AM   #5
iphonejudy
macrumors 6502
 
Join Date: Sep 2008
[QUOTE=henktade;7172571]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?
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Feb 27, 2009, 01:07 AM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by iphonejudy View Post
Can you please tell me the solution?
So, instead of trying to sort it out in your other thread, you're just gonna come here and post the same question? Not nice.
dejo is offline   0 Reply With Quote
Old Feb 27, 2009, 01:11 AM   #7
iphonejudy
macrumors 6502
 
Join Date: Sep 2008
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?
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Feb 27, 2009, 01:20 AM   #8
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by iphonejudy View Post
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;
dejo is offline   0 Reply With Quote
Old Feb 27, 2009, 03:16 AM   #9
iphonejudy
macrumors 6502
 
Join Date: Sep 2008
Quote:
Originally Posted by dejo View Post
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
__________________
Judy
iphonejudy is offline   0 Reply With Quote
Old Feb 27, 2009, 10:05 AM   #10
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by iphonejudy View Post
I think u didnt understand my pblm.
I think you didn't explain it properly then. Sorry.
Quote:
Originally Posted by iphonejudy View Post
Anyway i solved it.thanks
Would you mind explaining how you solved it? In case others have the same issue, they can learn from your approach.
dejo is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: How do I convert an NSData object to an NSDictionary object, and vice versa? moonman239 iPhone/iPad Programming 6 May 2, 2014 02:17 PM
When do you not need to declare an object? thedon1 iPhone/iPad Programming 4 Jul 1, 2013 08:56 AM
Changing an MSMatrix object arjena Mac Programming 6 Oct 14, 2012 02:06 PM
3D object viewer eagandale4114 Mac Applications and Mac App Store 1 Aug 30, 2012 03:55 AM
If money were no object. dannywalls76 iMac 23 Jul 24, 2012 01:27 AM

Forum Jump

All times are GMT -5. The time now is 09:51 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC