在.h中声明
<code>- (UIViewController *)viewController</code>
在view的.m中实现
<code>- (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;
}
</code>
<code>
跳转as:
JFChatListViewController *chatListVC = [[JFChatListViewController alloc]init];
[chatListVC setHidesBottomBarWhenPushed:YES];
[[self viewController].navigationController pushViewController:chatListVC animated:YES];
</code>