这是我在第一个viewcontroller.m文件中的代码:
RiskViewController *riskVC = [[RiskViewController alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];
riskVC.Address1 = @"THIS IS THE DATA IM TRYING TO SEND!";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: [NSBundle mainBundle]];
[self.navigationController pushViewController:[storyboard instantiateViewControllerWithIdentifier:@"Risk"] animated:YES];
这是我在第二个viewcontroller.h文件中的代码:
@interface RiskViewController : UIViewController <UITextFieldDelegate>
@property (nonatomic, strong) NSString * Address1;
这是我在第二个viewcontroller.m文件中的代码。它是NSLoging,self.Address1为null:
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Addy1%@", self.Address1);
}
为什么我的self.Address1字符串为null,它应该包含我发送的字符串,如何解决此问题以便发送数据?
答案 0 :(得分:0)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: [NSBundle mainBundle]];
RiskViewController *riskVC = [storyboard instantiateViewControllerWithIdentifier:@"Risk"]
riskVC.Address1 = @"THIS IS THE DATA IM TRYING TO SEND!";
[self.navigationController pushViewController:riskVC animated:YES];