在从堆栈上的视图调用下面的代码之前或之后,我想在程序将弹出的根视图上设置标签的文本。
[self.navigationController popViewControllerAnimated:YES];
将视图控制器推入堆栈时,我可以用另一种方式(如下所示),但我不知道从堆栈弹出时该怎么做
- (PushedViewController *) pushedViewController {
NSLog(@"Initialise view");
if (pushedViewController == nil) {
pushedViewController = [[PushedViewController alloc] initWithNibName:@"PushedView" bundle:nil];
}
return pushedViewController;
}
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[TableView deselectRowAtIndexPath:indexPath animated:YES];
Table* tableRow =[fetchedResultsController objectAtIndexPath:indexPath];
[self.navigationController pushViewController:self.pushedViewController animated:YES];
self.pushedViewController.code.text = tablerow.code;
}
如果有人能告诉我如何在不创建视图的新实例的情况下访问和设置堆栈上的视图变量,将不胜感激。