How to push text from one UITextfield to another UITextfield in the next View? And back!?

Posted by Chrizzz on Stack Overflow See other posts from Stack Overflow or by Chrizzz
Published on 2010-05-25T19:26:01Z Indexed on 2010/05/25 22:11 UTC
Read the original article Hit count: 217

an Hi,

I have an UITextField in one view, UITextField A in View A. And I have another in view B, UITextField B in View B.

I use a Navigation Controller Bar to switch between the views. The UITextFields are properties and connected Outlets of both views A and B.

On my view A there is an "Options"-button which pushes view B. So when you are typing in Textfield A, I would like the same text to appear in Textfield B.

When you edit TextField B and you go back to view A (via the "Title View A"-button in de navigation bar), I would like the same text to re-appear in Textfield A.

I expected this to be easy. But I can't get it working.

I tried: ViewBController *controller = [[ViewBController alloc] initWithNibName:@"ViewBController" bundle:nil]; controller.TextFieldA.text = TextFieldB.text

But nothing appeared in view B. And how do I get back? I dont want to use NSUserdefaults because I would have to remove the values also.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiviewcontroller