就像用iOS本机邮件应用程序编写新邮件一样。 或者你用stackoverflow iOS app询问新问题。
你有什么想法吗?
答案 0 :(得分:0)
尝试使用辅助方法
展示新的 ViewControllerextension UIApplication {
class func topViewController(base: UIViewController? = (UIApplication.sharedApplication().delegate as! AppDelegate).window?.rootViewController) -> UIViewController? {
if let nav = base as? UINavigationController {
return topViewController(base: nav.visibleViewController)
}
if let tab = base as? UITabBarController {
if let selected = tab.selectedViewController {
return topViewController(base: selected)
}
}
if let presented = base?.presentedViewController {
return topViewController(base: presented)
}
return base
}
}
从ViewController调用上面的辅助方法,如
UIApplication.topViewController().present(vc2, animated: true, completion: nil)