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
Post a Comment