///扩展中的方法
extension UIView {
var getCurrentVC: UIViewController? {
var next = superview
while (next != nil) {
let nextResponder = next?.next
if (nextResponder is UIViewController) {
return nextResponder as? UIViewController
}
next = next?.superview
}
return nil
}
}
网友评论