我推着这样的观点。
[[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);