I am in situation where i need to call didSelectRowAtIndexPath from another calls for that i do like this i make object of that class and call viewdidload so my table view get initialised
- (void)_hideTapped:(id)sender
{
LeftController *left = [[LeftController alloc]init];
[left viewDidLoad ];
}
in LeftController
- (void)viewDidLoad {
[super viewDidLoad];
mainArray = [[NSMutableArray alloc]initWithObjects:@"Go To Camera",@"Big Contacts List",@"Where Am I? On map",@"Watch And Alarm",@"Calculator With Big Letters",@"Big KeyBoard For Email",@"Calendar With Events",@"Settings", nil ];
// NSLog(@"mainArray%@",mainArray);
if (!_tableView) {
UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
tableView.delegate = (id<UITableViewDelegate>)self;
tableView.dataSource = (id<UITableViewDataSource>)self;
[self.view addSubview:tableView];
self.tableView = tableView;
[self iDecideWhichCell];
}
}
-(void)iDecideWhichCell
{
NSIndexPath *path = [NSIndexPath indexPathForRow:0 inSection:0];
[self tableView:self.tableView didSelectRowAtIndexPath:path];
}
this is part of my didSelectRowAtIndexPath i am using JASidePanels for splitview like facebook and this is how they push viewcontroller it works fine if i go to leftcontroller and click by my self but when i do this whole process programmatically then its not working
if (indexPath.row ==0)
{
NSLog(@"%@",tableView);
self.sidePanelController.centerPanel = [[UINavigationController alloc] initWithRootViewController:[[NewViewController alloc] init]];
}
please any one can tell me how can i achieve this i checked this answer calling didSelectRowAtIndexPath from other ViewController not responding iPad
but i dont understand how to implement this in my code