Ive got a function with the following syntax:
It gets triggered automatically by pressing a row in a UITableView.
On some occasions I want to trigger this function from another action, like pressing a button or something. But I cant figure out the code to call it.
Lets say I want to call the function as if I had pressed the second row in the tableview. My limited knowledge of obj-c tells me I should do this:
..where "MyViewController" is the viewcontroller that the tableview is located in, and the button from which Im calling this function is from AppDelegate.m. I do have a reference to that viewcontroller from there, since Ive imported it using:
Instead of working I get a warning saying
"warning: 'MyViewController' may not respond to '+didSelectRowAtIndexPath'
(Messages without matching method signature will be assumed to return 'id' and accept '...' as arguments"
Any ideas? Thansk/ Daniel
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ // do stuff }
It gets triggered automatically by pressing a row in a UITableView.
On some occasions I want to trigger this function from another action, like pressing a button or something. But I cant figure out the code to call it.
Lets say I want to call the function as if I had pressed the second row in the tableview. My limited knowledge of obj-c tells me I should do this:
Code:
[MyViewController didSelectRowAtIndexPath: 1];
..where "MyViewController" is the viewcontroller that the tableview is located in, and the button from which Im calling this function is from AppDelegate.m. I do have a reference to that viewcontroller from there, since Ive imported it using:
Code:
#import "MyViewController.h"
Instead of working I get a warning saying
"warning: 'MyViewController' may not respond to '+didSelectRowAtIndexPath'
(Messages without matching method signature will be assumed to return 'id' and accept '...' as arguments"
Any ideas? Thansk/ Daniel