单击按钮后,我将数据从 FirstView 传输到 SecondView。
FirstView.h
@property (strong, nonatomic) NSString *stringOfFirstView;
FirstView.m - (void)pushToSecond { SecondView *controller = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil]; controller.stringOfSecondView = self.stringOfFirstView; [self.navigationController pushViewController:controller animated:NO]; }
在 SecondView 中,我有
SecondView.h
@property (strong, nonatomic) NSString *stringOfSecondView;
在 SecondView,我的目标是通过单击后退按钮返回 FirstView,并且也想分配stringOfSecondView
给stringOfFirstView
问题 :
How can I assign stringOfSecondView to stringOfFirstView via clicking back button.
只是让你知道,我正在检测 SecondView 中的后退按钮上的点击事件,方法是
SecondView.m
- (void) viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:YES];
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound)
NSLog(@"will show onto console");
}
但是我被卡住了如何将数据传回
如果您对此问题有任何线索,请提出建议。