2 yue1liang1chuan yue1liang1chuan 于 2013.04.03 10:34 提问

获取导航中父View的类名

这样推出View:

[[self.navigationController pushViewController:myViewController animated:YES];

怎么样获取推出View(这是子view)的父View控制器的类名?

1个回答

Mr_me
Mr_me   2013.04.03 11:12
已采纳

这样:

NSUInteger numberOfViewControllersOnStack = [self.navigationController.viewControllers count];
UIViewController *parentViewController = self.navigationController.viewControllers[numberOfViewControllersOnStack - 2];
Class parentVCClass = [parentViewController class];
NSString *className = NSStringFromClass(parentVCClass);
Csdn user default icon
上传中...
上传图片
插入图片