Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
153 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...