swift3.0通过响应链获取当前试图的控制器

func parentViewController() -> UIViewController? {

let n = next

while n != nil {

let controller = next?.next

if (controller is UIViewController) {

return controller as? UIViewController } }

return nil

}

posted @ 2017-09-26 17:31  Leo-Wmw  阅读(442)  评论(0编辑  收藏  举报