简体   繁体   中英

How to pass a value from one view to another view

I have two views of two subpages. Here I want to pass the value from one sub class of view to another. I searched the web, but can't find a clear answer. Can anybody provide an example for passing a UITextField value from one to another?

You can maintain a common string in appDelegate.

Define a string

 NSString *commString;

in appDelegate.

And then when you submit the uitextfield value just assign that text field value to the

appDelegate.commString

use this in the next view.

ProjectNameAppDelegate *appDelegate = [[UIApplication sharedApplicatoin] delegate];
appDelegate.commString = textField.text;

This will work for sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM