我尝试从表中获取单元格的文本(在 ViewController B 中)并将其显示在 textView 中(在 ViewController A 中)。第一次一切都很好,但是第二次在控制台中出现错误消息: “嵌套的弹出动画会导致损坏的导航栏 在意外状态下完成导航转换。导航栏 subview 树可能会损坏。”
我的代码是: 在 ViewController B 中
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Retrieve the value of cell selected
self.valeurCell = [NSString stringWithFormat:@"%@", [tableView cellForRowAtIndexPath:indexPath].textLabel.text];
// Send the value of cell in the answer area (class: SendMessagesViewController)
[[NSNotificationCenter defaultCenter] postNotificationName:@"notice" object:self.valeurCell];
在 ViewController A 中 (viewDidLoad)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataTransfer:) name:@"notice" object:nil];
-(void) dataTransfer:(NSNotification *) sentObject{
// !!! en test !!!
self.textViewMsg.text = (NSString *) [sentObject object] ;
[self.navigationController popViewControllerAnimated:YES];
谢谢
最佳答案
在 viewDidAppear 之前弹出或推送 ViewController 是不安全的。执行这段代码 [self.navigationController popViewControllerAnimated:YES];在调用 viewDidAppear() 之后。
关于ios - 错误 : "nested pop animation can result in corrupted navigation bar",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25728002/