ios 获取view在哪个控制器
展开全部
(UIViewController *)viewController:(UIView *)view{
/// Finds the view's view controller.
// Traverse responder chain. Return first found view controller, which will be the view's view controller.
UIResponder *responder = view;
while ((responder = [responder nextResponder]))
if ([responder isKindOfClass: [UIViewController class]])
return (UIViewController *)responder;
// If the view controller isn't found, return nil.
return nil;
}
/// Finds the view's view controller.
// Traverse responder chain. Return first found view controller, which will be the view's view controller.
UIResponder *responder = view;
while ((responder = [responder nextResponder]))
if ([responder isKindOfClass: [UIViewController class]])
return (UIViewController *)responder;
// If the view controller isn't found, return nil.
return nil;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询