My view controller StartViewController is opened/added (addSubview) by one of two other view controllers (RootViewController or TelnetAddressbookViewController). Im trying to figure out which of those two is the one that launched StartViewController.
NSLog(@"superview %@",self.view.superview.description);
NSLog(@"superview %@",self.superclass);
if ([self.view.superview isKindOfClass:[RootViewController class]]) {
NSLog(@"launched by RootViewController");
}else if ([self.view.superview isKindOfClass:[TelnetAddressbookViewController class]]) {
NSLog(@"launched TelnetAddressbookViewController");
}
[self.view removeFromSuperview];
The first NSLOG (self.view.superview.description) outputs:
superview UIView: 0x81d6710; frame = (0 0; 748 1024); transform = [0,
1, -1, 0, 0, 0]; autoresize = RM+BM; layer = >
What its referencing is what I need (0x81d6710) but its class is a UIViewController instead of my custom view controllers.
I ended up setting a property, which does not answer the original question (sorry). There really should be a way though, even if I had done it by evaluating the frame of the super view.