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?
            Asked
            
        
        
            Active
            
        
            Viewed 1,877 times
        
    -1
            
            
        - 
                    Possible duplicate of [Passing Data between View Controllers](http://stackoverflow.com/questions/5210535/passing-data-between-view-controllers) – Philipp Schlösser Oct 14 '11 at 11:01
1 Answers
2
            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.
 
    
    
        Philipp Schlösser
        
- 5,179
- 2
- 38
- 52
 
    
    
        MohanVydehi
        
- 356
- 3
- 14
- 
                    1Pretty much what I was going to suggest, if it isnt what you're looking for ill post another similar solution but this is what you're asking. Nice one Mohan – Elmo Oct 14 '11 at 10:56
- 
                    Add NSString *commString; in projectAppDelegate .h file, then declare property in the file. Synthesis the string in .m file @synthesis commString; add commString = [[NSString alloc] init]; in the app delegate launch method. Then this string to store the text field value. Store the text field value when you submit the form. In the action method add addDelegate.commString = textField.text; Before that – MohanVydehi Oct 14 '11 at 11:07
- 
                    add ProjectAppDelegate *appDelegate = [[UIApplication sharedDelegate] delegate]; Then you can use the appDelegate .commString where ever you want. – MohanVydehi Oct 14 '11 at 11:13
- 
                    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIApplication sharedApplicatoin]: unrecognized selector sent to class 0x8631d4' Its shown in console error. – akk Oct 14 '11 at 12:17
 
    