Maroun
Maroun

Reputation: 28

didSelectRowAtIndex isn't working

I am trying to push a url string to my Main and it present my main view controller when I press on the cell.

This is my code.

 #pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Index Selected,%d",indexPath.row);

    MainViewController *View = [self.storyboard instantiateViewControllerWithIdentifier:@"main"];

    [self.navigationController modalTransitionStyle];
    NSString *urltoPass = [NSString stringWithString:[[tableData objectAtIndex:indexPath.row]objectForKey:@"cellSubtitle"]];

    View.urlString = [[NSString alloc] initWithFormat:@"http://%@",urltoPass];
    View.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [myTableView deselectRowAtIndexPath:indexPath animated:YES];

}

Upvotes: 0

Views: 55

Answers (1)

P. Sami
P. Sami

Reputation: 2207

You need to call

– presentViewController:animated:completion:

on your View Controller to present it.

Upvotes: 1

Related Questions