简体   繁体   English

将字符串值从一个视图控制器传递给另一个

[英]Pass a string value from one view controller to another

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: 从主菜单登录方法中,我将Web服务的结果值传递给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. 最可能的解释是, username_TextField属性未链接到实际的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. (1)检查SecondMenu标头中username_TextField的属性定义是否定义为IBOutlet,以及(2)实际上已在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 . 查看链接中的完整代码,看来username_TextField属性是Class LoginController的属性,但是在此代码中,您具有实例lcv2作为Class SecondMenu There is nothing in the code you provided to show that the SecondMenu Class has a username_TextField property. 您提供的代码中没有任何内容表明SecondMenu类具有username_TextField属性。 If you initialize lcv2 as an instance of LoginController the code above will work assuming you have the outlets wired correcting in interface builder. 如果您将lcv2初始化为LoginController的实例,则上面的代码将在您假设接口构建器中的插座已接线校正的情况下起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将字符串值从一个视图控制器传递到另一个视图控制器 - how to pass a string value from one view controller to another view controller 无法将值从一个视图控制器传递到情节提要上的另一个 - Not able to pass value from one view controller to another on storyboard 如何将字符串值从一个控制器传递到另一个 - how to pass a string value from one controller to another 我无法将值从一个视图控制器传递给另一个视图控制器 - i am not able to pass value from one view controller to another view controller 程序将字符串从一个视图传递到另一个视图? - Program to pass string from one view to another? 如何在IOS中将数据从一个视图传递到另一个视图控制器? - How to pass data from one view to another view controller in IOS? 如何将数组从一个视图 controller 传递到另一个视图? - How to pass an array from one view controller to another? 如何使用委托将数据从一个视图控制器传递到另一个视图控制器? - how to use delegate to pass data to from one View Controller to another? 将nsmutablearray从一个ViewController传递到另一个View Controller - Pass nsmutablearray from one viewcontroller to another view controller 如何将变量从一个视图控制器传递到另一个? - How to pass a variable from one view controller to another?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM