1

Possible Duplicate:
Passing Data between View Controllers

I have 2 view controller:

  1. Index
  2. Second

In Index I have 2 textfield and button.

I fill this text field and press "next button" to second view, I need to "show" this two text field, by using Array (later I will send JSON data). How I can best realize? Please help! Best regards
Ivan.

Community
  • 1
  • 1
MeGaPk
  • 143
  • 2
  • 10

1 Answers1

1

Declare an @property in class Second as textArray. And then while pushing to Second from Index, you need to set this property.

In Second.h file,

@property(nonatomic, strong) NSArray *textArray;

In Index.m file,

Second *aSecond = [[Second alloc] init];
aSecond.textArray = @[textField1.text, textField2.text];
//write code to push from Index to Second

Now in class Second, you can use it as aSecond.textArray[0] and aSecond.textArray[1]

iDev
  • 23,310
  • 7
  • 60
  • 85