swift - 在 swift 3 中播放音频时如何进入当前 viewController?

标签 swift swift3

目前,我构建了简单的应用程序音乐,如果我让当前的 View Controller (musicController)正在播放到另一个 Controller 并且我创建了一个按钮“NowPlaying”放在另一个 Controller 上以在没有负载的情况下运行我当前的 View Controller (musicController),我想这样做任何观点。请帮助我

谢谢

最佳答案

试试我的工作代码,

var currentTopMostChildCont: UIViewController = self.getCurrentTopMostChildController()


func getCurrentTopMostChildController() -> UIViewController {
    var topController: UIViewController = UIApplication.sharedApplication().keyWindow.rootViewController
    while topController.childViewControllers.count() > 0 {
        topController = topController.childViewControllers.last //You can track your viewController which you want & get it.
    }
    return topController
}

希望对你有所帮助。

关于swift - 在 swift 3 中播放音频时如何进入当前 viewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42184864/

相关文章:

ios - ReactiveCococa : Module compiled with Swift 2. 3 无法在 Swift 3.0 中导入

json - 如何使用 Codable 在 Swift 4 中解析复杂的 JSON

Swift 2 to 3 迁移核心数据 NSManagedObject 类

ios - shouldInteractWith url textview 委托(delegate)未在 ios9 中调用但在 ios10 中工作?

ios - 无法在tableview Swift中显示核心数据

Swift 3 太空射击游戏 : Issue with bullet collision

ios - adddependency 方法在 NSOperationQueue 中的工作原理

swift - 表格 View : search bar that uses indexPath. 行

ios - Xcode7 : How to mail crash report in swift

swift - 不等式约束以编程方式快速实现