I'm pushing a view like this.
[[self.navigationController pushViewController:myViewController animated:YES];
How Can I get class name of parent view controller from pushed view (child view)? Any Idea?
I'm pushing a view like this.
[[self.navigationController pushViewController:myViewController animated:YES];
How Can I get class name of parent view controller from pushed view (child view)? Any Idea?
This should do it:
NSUInteger numberOfViewControllersOnStack = [self.navigationController.viewControllers count];
UIViewController *parentViewController = self.navigationController.viewControllers[numberOfViewControllersOnStack - 2];
Class parentVCClass = [parentViewController class];
NSString *className = NSStringFromClass(parentVCClass);
Get class of parent view controller:
id class = [self.navigationController.viewControllers[0] class];
and its name:
NSString *className = NSStringFromClass(class);