これをParentViewControllerの .h ファイルに取り込みます
NSString *strABC;
ParentViewControllerで以下の関数を作成します
-(void)setString:(NSString *)strEntered{
strABC=strEntered;
}
In Postビューコントローラーは次のようにします:
ParentViewController *objSecond =
[[ParentViewController] initwithNibName:@"parentView.xib" bundle:nil];
[objSecond setString:@"Comment Controller"];
[self.navigationController pushViewController:objSecond animated:YES];
[objSecond release];
ここで、secondViewController viewWillAppear
メソッドにこれを記述します。
-(void)viewWillAppear:(BOOL)animated{
lblUserInput.text = strABC;
}
手書きなので誤字脱字はご容赦ください。この助けを願っています。
使用していない場合はUINavigationContoller
、このようなことができます。
SecondViewControler *objSecond =
[[SecondViewController] initwithNibName:@"secondview.xib" bundle:nil];
[objSecond setUserInput:txtUserInput.text];
[objSecond viewWillAppear:YES];
[self.view addSubview:objSecond];
[objSecond release];