It is easy.
Suppose I have two views: firstView and SecondView.
firstView is the ROOT view.
I load secondView from firstView:
secondView *secondViewController;
secondViewController = [[SecondView alloc]
initWithNibName:@"SecondView" bundle:nil];
[self.view addSubview:SecondViewController.view];
I added a “Back” button in secondView.
When I click that button I go back to firstView:
[self.view removeFromSuperView];
Here is the question:
When firstView -> secondView, viewDidLoad in secondView is triggered.
How can I trigger an event to inform firstView when I go back using removeFromSuperView in secondView?
What do you want to do exactly ? maybe you just want to go from your first view controller to your second view controller ? and then go back to your first view controller ? in this case just do like this, if your first controller is already embbeded in a navigation controller:
But if you just want to create a view from Interface Builder and then add it above your first view, you can use the notification center to post an event when you click on your Back button from your second view:
You can then add an observer for this event in your first view controller, like this:
I hope this will help you !