2つのコンテナ(上に1つ、下に1つ)を格納するViewControllerがあります。トップコンテナには、ボタンとテキストフィールドを備えたViewControllerが格納されています(説明のためだけに)。私がやりたいことは:
- テキストを入力
- ボタンを押す
- bottomViewControllerにテキストを送信します
- テーブルに表示
どうすればbottomViewControllerにテキストを送信できますか?どういうわけか親と話をする必要がありますか?
ストーリーボードを使用しているので、parentViewControllerにこれがあります
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSLog(@"Current Segue: %@", segue.identifier);
if ([segue.identifier isEqualToString:@"topSegue"]) {
self.enterCommentViewController = segue.destinationViewController;
}
else if ([segue.identifier isEqualToString:@"bottomSegue"]) {
self.commentsViewController = segue.destinationViewController;
}
}