在非模态时,展开segue不会忽略自适应弹出窗口 [英] Unwind segue doesn't dismiss adaptive popover presentation when not modal
问题描述
iOS 9测试版的更新:Apple可能已针对iOS 9解决此问题。如果您针对iOS 8解决此问题,请确保它在iOS 9上也能正常运行。
在故事板中,我创建了一个popover演示文件segue,用于从按钮呈现导航和视图控制器,以及创建展开segue。
In storyboard, I've created a popover presentation segue to present a navigation and view controller from a button, as well as creating an unwind segue.
在纵向方向上,模态(全屏)演示文稿按预期展开/解除。
In portrait orientation, the modal (fullscreen) presentation is unwound/dismissed, as expected.
在横向方向,展开segue也会获得但是,popover演示文稿是而不是自动被解雇。
In landscape orientation, the unwind segue also gets called, however the popover presentation is not automatically dismissed.
我是否错过了挂钩的东西?我是否必须自行解除popover演示文稿?
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)__unused sender
{
if ([[segue identifier] isEqualToString:@"showSelectBookChapter"])
{
UINavigationController *navigationController = segue.destinationViewController;
if ([navigationController.topViewController isKindOfClass:[BIBLESelectViewController class]])
{
BIBLESelectViewController *selectViewController = (BIBLESelectViewController *)navigationController.topViewController;
selectViewController.initialBookChapterVerse = self.bookChapterVerse;
}
}
}
- (IBAction)unwindToBIBLEChapterViewController:(UIStoryboardSegue *)segue
{
if ([segue.identifier isEqualToString:@"unwindToBIBLEChapterViewController"]) {
if ([segue.sourceViewController isKindOfClass:[BIBLESelectViewController class]])
{
BIBLESelectViewController *sourceViewController = (BIBLESelectViewController *)segue.sourceViewController;
self.bookChapterVerse = sourceViewController.selectedBookChapterVerse;
[self.tableView reloadData];
}
}
}
更新:
查看gabbler的样本后代码,我已经将问题缩小到popover在单视图应用程序中解雇罚款,但不在主细节应用程序中解决。
Update: After looking at gabbler's sample code, I've narrowed the problem down to popover dismissing fine in a Single View Application, but not in a Master-Detail Application.
更新2:
以下是层次结构的样子(为简单起见省略了导航控制器),回答了Luis问的问题:
Update 2: Here's what the hierarchy looks like (omitting navigation controllers for simplicity's sake), in answer to the question Luis asked:
- 拆分视图控制器
- 主视图控制器
- 详细视图控制器
- 章节视图控制器(模态页面表)
- 选择视图控制器(解开章节视图控制器的有问题的弹出窗口,但不是'解雇)
正如我之前提到的那样pdate,我创建了一个新的主/详细模板,并直接从详细视图中的(按钮)中显示一个弹出窗口。它不会被解雇。
As I mentioned in the previous update, I created an new master/detail template, and simply presented a popover directly from (a button in) the detail view. It won't dismiss.
推荐答案
我也遇到了这个问题。我从主视图控制器(UISplitViewController)以模态方式(作为表单)呈现视图控制器。这个问题只发生在iPad上(也可能是横向模式下的iPhone 6+,但我没有检查)。我最终在我的展开动作方法(使用Swift)中执行以下操作,并且它运行良好。
I ran into this problem too. I present a View Controller modally (as a form sheet), from the Master View Controller (UISplitViewController). The problem only occurred on the iPad (probably the iPhone 6+ in landscape mode too, but I didn't check it). I ended up doing the following in my unwind action method (using Swift), and it works good.
if !segue.sourceViewController.isBeingDismissed() { segue.sourceViewController.dismissViewControllerAnimated(true, completion: nil) }
这篇关于在非模态时,展开segue不会忽略自适应弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 章节视图控制器(模态页面表)