Last active
July 22, 2019 09:04
-
-
Save MadeBugs/82c894d6691eabd88a45903282959632 to your computer and use it in GitHub Desktop.
swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 如果是系统的弹窗,则无法获取到,比如在用Airprint,这时是无法获取到的,结果为nil | |
func getPrexxx() -> UIViewController { | |
var result = UIApplication.shared.keyWindow?.rootViewController | |
while ((result?.presentedViewController) != nil) { | |
result = result?.presentedViewController | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment