ios - 从 App Delegate 打开导航 Controller

标签 ios swift swift3 appdelegate

我已经实现了一个 URL 方案,用于在付款后重定向回我的应用程序。当网页直接返回我的应用程序时,该应用程序应该在当前 View 上打开一个导航 Controller 。 (所以打开它模式)。

如何从 func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool-method 中的 AppDelete 执行此操作?

提前致谢!

最佳答案

您是使用 Storyboard还是在委托(delegate)中手动创建窗口?如果您有权访问该窗口,则可以执行以下操作:

window?.rootViewController?.present(yourViewController, animated: true, completion: nil)

否则,它应该适用于所有情况:

UIApplication.shared.keyWindow?.rootViewController?.present(yourViewController, animated: true, completion: nil)

关于ios - 从 App Delegate 打开导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46472218/

相关文章:

ios - 使用 setUbiquitous 为 UIDocument 文件关闭 iCloud 同步时出错(LibrarianErrorDomain 错误 2)

ios - 如何在 UIView swift 中重新加载特定的 subview ?

ios - 如何在 BarCharts IOS 图表中创建多个数据集

swift - 具有关联类型类型转换的保护案例的单个表达式?

swift - 无法使用类型的参数列表调用 'jsonObject'

ios - swift 设计模式。为什么他们包括 Any, AnyObject

iphone - 我可以手动调用设备旋转时发生的相同自动调整代码吗?

swift - 返回 Realm 中任何可以删除的对象

swift - 向按钮添加操作,该按钮通过快速扩展添加到文本字段

swift - Xcode 没有这样的模块 : 'PackageDescription'