IPhone, how to add a view controller view to another kind of controller controller?

It's been a long time in my mind, and I really don't know how to correctly add a view controlled by a view controller to another view controller view.

This does not work because the view does not finish loading

self.messageViewController = [[PopupMessagesViewController alloc] initWithNibName:@"PopupMessagesViewController" bundle:nil];
[self.view addSubview:self.messageViewController.view];

How can I add the UIView created by the view controller from the nib element to another view manager view? How can I make such a view load before adding it?

+3
source share
3 answers

, . , UIViewControllers, . , subview UIViewController, .

iOS 5 UIViewController, , .

+2

try it

- (void)viewWillAppear: (BOOL)animated {
    [super viewWillAppear: animated];
    [self.messageViewController viewWillAppear];
}

- (void)viewDidAppear: (BOOL)animated {
    [super viewDidAppear: animated];
    [self.messageViewController viewDidAppear];
}
0
source

All Articles