开发者

selecting row at indexpath doesn;t work

开发者 https://www.devze.com 2023-03-15 04:54 出处:网络
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

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开发者_C百科];

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

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

        }
        break;
            default:
            break;
    }

}


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];
0

精彩评论

暂无评论...
验证码 换一张
取 消