Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Danneman101

macrumors 6502
Original poster
Is it possible to manually call the tableview's didSelectRowAtIndexPath with, say, the row-nr 1?

Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ 
     // stuff
}

If so, how would you construct that call? Im a bit confused as to how to make a functioncall with parameters in obj-c. My guess would be:

Code:
[MyTableView didSelectRowAtIndexPath:1];

..since my viewcontroller both declares and sets to property "MyTableView" in .h, and synthezises it in .m.

But even though it compiles (with a warning that "UITableView may not respond to -"didSelectRowAtIndexPath"), it crashes pretty quickly.
 
Did you put a prototype in your interface declaration?

Did you intend to to pass an integer into a indexPath object pointer parameter?
 
Did you put a prototype in your interface declaration?

No, I just declared the tableView as such:
Code:
@interface Level1ViewController : UIViewController <UINavigationBarDelegate, UITableViewDelegate, UITableViewDataSource>
{
	IBOutlet UITableView			*myTableView;
}

The actual function-definition (didSel..) is in the .m-file. Do I need to put its prototype in the .h-file as well?


Did you intend to to pass an integer into a indexPath object pointer parameter?

Well, what I want to do is that under a certain condition managed by a settings-variable (for instance, if "setting_row == 1"), I want a table-row to be automatically selected as if row 1 in the tablerow had been pressed which would have called didSelectRowAtIndexPath. So that would mean manually passing the row-nr as a parameter, but perhaps it should not be in the form of an integer?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.