我正在推动这样的观点。
[[self.navigationController pushViewController:myViewController animated:YES];
如何从推送视图(子视图)中获取父视图控制器的类名?Any Idea?
我正在推动这样的观点。
[[self.navigationController pushViewController:myViewController animated:YES];
如何从推送视图(子视图)中获取父视图控制器的类名?Any Idea?
这应该这样做:
NSUInteger numberOfViewControllersOnStack = [self.navigationController.viewControllers count];
UIViewController *parentViewController = self.navigationController.viewControllers[numberOfViewControllersOnStack - 2];
Class parentVCClass = [parentViewController class];
NSString *className = NSStringFromClass(parentVCClass);
获取父视图控制器的类:
id class = [self.navigationController.viewControllers[0] class];
及其名称:
NSString *className = NSStringFromClass(class);