I think that I am missing something fundamental, and therefore I want to ask the community for help. I am creating an application based on the basic application for the iPhone. My MainView and FlipsideView have some elements, so I created separate ViewControllers and nib files for these fragments. To do this, I did the following: 1. Created a viewcontroller called searchDateViewController, which is the owner of the searchDateView.xib file 2. searchDateView.xib is basically a UIView with a UILabel inside, the view is connected correctly 3. Inside MainViewController.m and FlipsideViewController.m. I add subview as folllows:
- (void)loadView{
[super loadView];
searchDateViewController = [[SearchDateViewController alloc] initWithNibName:@"SearchDateView" bundle:nil];
[[searchDateViewController view] setFrame:[searchDateView frame]];
[[self view] addSubview:[searchDateViewController view]];
...
}
Everything displays and works perfectly. Basically, depending on the actions that occur in each of the main and reverse representations, UILabel from nib changes. However, I wanted to do something a little different if the searchDateViewController is loaded from MainView or FlipsideView. However, I cannot figure out which ViewController adds the searchDateViewController routine.
In searchDateViewController, I tried:
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"superview %@", self.view.superview);
NSLog(@"parentviewcontroller %@", self.parentViewController);
}
In both cases, I get zero.
So my question is: can I find out which ViewController adds searchDateViewController a subview? If so, how? Or, if my logic here is completely confused, how can I do this?
Thanks!
source
share