-1

Possible Duplicate:
Passing Data between View Controllers

I have two UIViewController: "MenuViewController" and "DetailViewController".

I'm trying to set DetailViewController's label text as a NSString in the MenuViewController, but doesn't work.

Does anyone know how to do this?

Community
  • 1
  • 1
Layla
  • 1

1 Answers1

1

it is very simple, add @property (retain) NSString* string; in the DetailedViewController and before navigate to it set this property like this

DetailedViewController *dvc = [[DetailedViewController alloc] init];
[dvc setString:@"someString"];
[self pushViewController:dvc]

in DetailedViewController in ViewDidLoad set the label:

[[self label] setText:[self string]];
s1m0n
  • 7,825
  • 1
  • 32
  • 45
Hossam Ghareeb
  • 7,063
  • 3
  • 53
  • 64