objective c - iOS - Calling method in distant class -


i'm working on application in require call function class viewcontroller when instructed in class newnotecontroller.

i change between different view controllers way:

nsstring * storyboardname = @"main"; uistoryboard *storyboard = [uistoryboard storyboardwithname:storyboardname bundle: nil]; uiviewcontroller * vc = [storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller"]; [self presentviewcontroller:vc animated:no completion:nil]; 

the problem this, when switch viewcontroller, (void)viewdidload not called. should use call method in viewcontroller.m newnotecontroller.m?

try using below code..

nsstring * storyboardname = @"main"; uistoryboard *storyboard = [uistoryboard storyboardwithname:storyboardname bundle: nil]; viewcontroller * vc = [storyboard instantiateviewcontrollerwithidentifier:@"viewcontroller"]; [vc yourmethodname]; [self.navigationcontroller pushviewcontroller:vc animated:yes]; 

hope helps you..


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -