gpt4 book ai didi

iOS 8 多个弹出窗口 - "Warning: Attempt to present * on * which is already presenting (null)"

转载 作者:行者123 更新时间:2023-11-29 10:22:32 29 4
gpt4 key购买 nike

我有两个 UIBarButtonItem,它们都在我的 iOS 8 应用程序中打开一个带有导航 Controller 的弹出窗口。两者均使用 storyboards 进行设置,类型为 Present As Popover 且“Animates”设置为 true。 “ anchor ”设置为相应的 UIBarButtonItem

在代码中,这是呈现弹出窗口/执行转场之前的配置。

override public func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
if segue.identifier == SEGUE_ID_ADD_ACTION {
if let actionViewController = (segue.destinationViewController as! UINavigationController).topViewController as? ActionViewController {
let newAction = Action()
actionViewController.selectedAction = newAction
actionViewController.delegate = self
}
}
else if segue.identifier == SEGUE_ID_FILTER {
let controller = (segue.destinationViewController as! UINavigationController).topViewController as! FilterViewController
controller.delegate = self
controller.setup(filter)
segue.destinationViewController.popoverPresentationController!.delegate = controller
}
}

两个显示的 View Controller 类都没有更多特定于弹出窗口的代码:

let size = CGSizeMake(320, 460)
self.navigationController?.preferredContentSize = size

viewWillAppear

我遇到的问题是,当弹出框 A 出现时,我按下按钮打开弹出框 B。日志中显示错误,但没有任何反应。弹出框 B 最好显示或至少隐藏弹出框 B(类似于单击弹出框外的任何其他地方)。日志错误:

 Warning: Attempt to present <UINavigationController: 0x7fbdac027000>  on <xxx.ActionListViewController: 0x7fbdac075000> which is already presenting (null)

最佳答案

添加

self.navigationController?.popoverPresentationController?.passthroughViews = nil

在弹出窗口中的包含 View Controller 中至少是固定的,因此当单击导航项中的另一个按钮时确实触发了另一个弹出窗口的关闭。

关于iOS 8 多个弹出窗口 - "Warning: Attempt to present * on * which is already presenting (null)",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34224382/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com