开发者

Pass a string value from one view controller to another

开发者 https://www.devze.com 2022-12-10 23:25 出处:网络
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 m开发者_如何学Cain menu login method I pass a result value of a web se

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 m开发者_如何学Cain 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];
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消