How do I call a method from another view controller
facebook-graph-api, ios, iphone, objective-c
Solution
First, you probably also want to init your APICallsViewController via:
APICallsViewController *apiViewController = [[APICallsViewController alloc] initWithNibName:nil bundle:nil];
Then if that getUserFriend... is a method of APIViewController, you can do this:
[apiViewController getUserFriendTargetDialogRequest];
However, since you aren't passing any arguments in from your other view controller, you might consider calling it in the init method, or the viewDidLoad method of APICallsViewController.
Problem
I want to call this method: ``` - (void)getUserFriendTargetDialogRequest { currentAPICall = kAPIFriendsForTargetDialogRequests; [self apiGraphFriends]; } ``` from this conditional statement that's in another viewcontroller: ``` if (idx == 2) { NSLog(@"you touched menu 2"); APICallsViewController *apiViewController = [APICallsViewController alloc]; [self.navigationController pushViewController:apiViewController animated:YES]; } ``` can anyone help with the syntax on this? thanks so much