tags:

views:

320

answers:

1

I am using this way to pass a string value from one view controller to another but still it's not working. Please help! From the main menu login method I pass a result value of a web service to SecondMenu:

- (IBAction)MainMenuLogin_Method:(id)sender
{
    SecondMenu *lc2=[[SecondMenu alloc] initWithNibName:@"SecondMenu" bundle:nil];

    lc2.username_TextField.text=@"hello";// in actual it is a soap result

    //[self presentModalViewController:lc2 animated:YES];
    [[[[UIApplication sharedApplication] delegate] window] addSubview:lc2.view];
}
A: 

The most likely explanation is that the username_TextField property is not linked to the actual UITextView. (1) Check that the property definition of username_TextField in the SecondMenu header is defined as an IBOutlet and that (2) it is actually linked up in Interface Builder.

Edit:

Looking at the full code at your link, it looks like the username_TextField property is a property of the Class LoginController but in this code you have instance lcv2 as Class SecondMenu. There is nothing in the code you provided to show that the SecondMenu Class has a username_TextField property. If you initialize lcv2 as an instance of LoginController the code above will work assuming you have the outlets wired correcting in interface builder.

TechZen
i have pasted the entire code , please check this link.http://stackoverflow.com/questions/1693783/how-to-pass-a-string-value-from-one-controller-to-another.
shreedevi
You haven't pasted the entire code because there is no class definition for `SecondMenu` in either post. If SecondMenu either lacks the `username_TextField` property or it is not connected in the nib, the text field will not populate.
TechZen