Iphone 解雇一名非法移民

Iphone 解雇一名非法移民,iphone,ipad,ios,Iphone,Ipad,Ios,如何从导航堆栈中删除popover。我有一个导航控制器作为popover的根控制器,堆栈中有两个TAE VIE。因此,第一个表视图推送第二个表视图,第二个表视图应关闭popover。我可以将一个参考从一个表传递到另一个表,尽管这似乎是错误的。浏览不同控制器后,解除popover的首选方式是什么?在appdelegate中,添加新的NSNotificationCenter观察员: [[NSNotificationCenter defaultCenter] addObserver:self

如何从导航堆栈中删除popover。我有一个导航控制器作为popover的根控制器,堆栈中有两个TAE VIE。因此,第一个表视图推送第二个表视图,第二个表视图应关闭popover。我可以将一个参考从一个表传递到另一个表,尽管这似乎是错误的。浏览不同控制器后,解除popover的首选方式是什么?

在appdelegate中,添加新的NSNotificationCenter观察员:

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(hidePopover)
name:@"hidePopover"
object:nil];
这种方法很好,因为现在您已经设置好了可以从任何地方关闭popover的方式。你这样做:

[[NSNotificationCenter defaultCenter] postNotificationName:@"hidePopover" 
object:nil];
[[NSNotificationCenter defaultCenter]postNotificationName:@“HidePover”
对象:nil] 希望这能解决你的难题


Zane

在您的appdelegate中,添加一个新的NSNotificationCenter观察员:

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(hidePopover)
name:@"hidePopover"
object:nil];
这种方法很好,因为现在您已经设置好了可以从任何地方关闭popover的方式。你这样做:

[[NSNotificationCenter defaultCenter] postNotificationName:@"hidePopover" 
object:nil];
[[NSNotificationCenter defaultCenter]postNotificationName:@“HidePover”
对象:nil] 希望这能解决你的难题


Zane

但dismissPopover方法不是类方法。所以我需要一个对应用程序委托中的popover的引用??为什么它不能像模态视图控制器一样工作呢?如果你阅读apple文档,他们会说在你的标题中保留对popover控制器的引用作为属性,这样视图就不必每次显示时都创建。您将用对象的名称替换UIPopOverController。对不起,我应该更清楚这一点。这在UIPopoverController类引用中吗?是的,只需将UIPopoverController部分替换为对象引用(myPopover)的名称,但dismissPopover方法不是类方法。所以我需要一个对应用程序委托中的popover的引用??为什么它不能像模态视图控制器一样工作呢?如果你阅读apple文档,他们会说在你的标题中保留对popover控制器的引用作为属性,这样视图就不必每次显示时都创建。您将用对象的名称替换UIPopOverController。对不起,我应该更清楚这一点。这在UIPopoverController类引用中吗?是的,用对象引用(myPopover)的名称替换UIPopoverController部分