0
votes

on viewdidload of one of my tabbar viewcontrollers I'll like to display or popup another view controller. here's my code

 if (_history.count == 0) {

    //[self performSegueWithIdentifier:@"emptyHistorySegue" sender:self];
    UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    MSAEmptyHistoryViewController *popupController = [sb instantiateViewControllerWithIdentifier:@"EmptyHistoryViewController"];
    [self presentViewController:popupController animated:NO completion:nil];
}

The load the viewcontroller on top of the tabview controller. I need this view to display but still allow the user to see the tabbar buttons.

2

2 Answers

0
votes

You will run into problems if you try to transition to another view controller in viewDidLoad. You should either switch the child view controllers of the tab bar controller or you can present a subview within one of the child view controllers.

0
votes

When -viewDidLoad is called, the view controller is generally not presented. As such, if you try to present another controller, it will crash.

Try -viewDidAppear: if you want what you are describing.