Search code examples
iosios7appdelegateviewdidload

Call viewdidload from appDelegate


I want to call the viewDidLoad in my view controller from my appDelegate. How do I do so?

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    TCAViewController *uiTCA = [[TCAViewController alloc] init];

    if(uiTCA.failed == 1){

        //Here I want to call viewDidLoad

// I thought something like this would work but I get an error
// [self uiTCA.viewDidLoad];


    }
}

Solution

  • You don't call viewDidLoad, the system calls it when all the outlets have been set on the view controller.

    Create a method - (void)doSomething; in your TCAViewController class and call that in your AppDelegate.

    [uiTVA doSomething];