Amrit
Amrit

Reputation: 421

selecting row at indexpath doesn;t work

Hi guys i have different section in my tableview ( more than 6) and each one has different rows. But only one of them leads to next view controllers here is the code but when i click it its not working

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSUInteger section = [indexPath section];
    NSUInteger row = [indexPath row];
    switch (section) 
    {
        case 5:
        {
            switch (row) 
            {
                case 0:
                {
                    Language_view_controller * language_controller = [Language_view_controller alloc];

                    [self.navigationController pushViewController:language_controller animated:YES];

                    [language_controller release];
                }
                    break;
                    default:
                    break;
            }

        }
        break;
            default:
            break;
    }

}

Upvotes: 0

Views: 385

Answers (1)

BP.
BP.

Reputation: 10083

You are just allocating the memory for your view controller, you also need to initialize it by doing something like this:

Language_view_controller * language_controller = [[Language_view_controller alloc] initWithNibName:@"Language_view_controller" bundle:nil];
[self.navigationController pushViewController:language_controller animated:YES];
[language_controller release];

Upvotes: 3

Related Questions