0

I have a UIViewController its my main view controller. When the app starting that main viewcontroller is loading. Then there is a bar button. When I click on that, another view controller loding like this.

LoginViewController *viewController = [[LoginViewController alloc]
                                       initWithNibName:@"LoginViewController" bundle:nil];

viewController.mainViewController = self ;

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];

[navController setModalPresentationStyle:UIModalPresentationFormSheet];

navController.navigationBar.tintColor = [UIColor blackColor];

[self presentModalViewController:navController animated:YES];

In that new view controller I am doing some tasks and when click the close button, the results should be loaded in on the parent view controller.How can I do this. In parent view controller ViewDidAppear also not calling when I just close the top view controller. How can I do this? Please help me.

Thanks

IRD
  • 1,127
  • 2
  • 8
  • 15

1 Answers1

0

First of all the line of code

[self presentModalViewController:navController animated:YES]; 

is deprecated and its been a long time, I don't know why are you still using it.

// Use below code instead
[self presentViewController:viewController animated:YES completion:nil];

Also you need to use protocols and delegates to pass any object to parent viewcontroller while you are dismissing the other viewcontroller.

If you can show up some code we might be able to figure out that why your viewDidAppear is not calling.