ios 获取当前view的controller

时间:2014-05-21 23:38:35   收藏:0   阅读:1000

 //获取viewcontroller

 - (UIViewController *)viewController {

    for (UIView* next = [self superview]; next; next = next.superview) {

        UIResponder *nextResponder = [next nextResponder];

         if ([nextResponder isKindOfClass:[UIViewController class]]) {

             

                return (UIViewController *)nextResponder;

            }

        }

         return nil;

 }

ios 获取当前view的controller,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!