如何从导航堆栈中解除弹出窗口。我有一个导航控制器作为弹出窗口的根控制器和2个塔架在堆栈中查看。因此,第一个表视图推送第二个,第二个应该忽略弹出窗口。虽然这似乎是错误的,但我可以将表格中的引用传递给popover的表格。在浏览不同的控制器后解除弹出窗口的首选方法是什么?
答案 0 :(得分:6)
在你的appdelegate中,添加一个新的NSNotificationCenter观察者:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(hidePopover)
name:@"hidePopover"
object:nil];
完成设置后,在appdelegate中添加一个新方法,如下所示:
-(void)hidePopover{
[UIPopoverController dismissPopoverAnimated:YES];
}
这种方法非常棒,因为现在您可以通过这种方式设置内容,以便可以从任何地方关闭弹出窗口。你这样做是这样的:
[[NSNotificationCenter defaultCenter] postNotificationName:@"hidePopover"
object:nil];
希望这能解决你的难题,
赞恩