I have a viewController that I want him to pop when I moving to another tab in the application. My problem is that when I'm inside this view I have a "plus" button for adding people with ABPeoplePickerNavigationController, than when the people picker becomes active, the view is popping as well, so when I finished of choosing people the application crushes, because it don't have any view to come back to.
this is the viewWillDisappear:
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController popViewControllerAnimated:YES];
}
How can I solve it?
New code:
- (void)viewWillDisappear:(BOOL)animated
{
NSArray *controllers = self.darioTabController.childViewControllers;
UIView *v;
for (UIViewController *vc in controllers)
{
if ([vc isKindOfClass:[@"ModalPresnterViewController" class]]) // or even [ABPeoplePickerNavigationController class]
{
v = vc.view;
}
else
[self.navigationController popViewControllerAnimated:YES];
}
}
Thanks!