简体   繁体   中英

TableView Row Selected Problem

I have tab based application with 2 tabs -> Home and News .

In my News tab I have a table with 2 rows, General News , sports news .

When I click General News , I want to show my RSS View. (With button to return to the News tab)

Please can someone tell me how to do this, I looked online and its very confusing.

Thanks a million.

I created a controller and in the .m file I did the following

// Override to support row selection in the table view. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[tableView deselectRowAtIndexPath:indexPath animated:YES];

if ([[array objectAtIndex:indexPath.row] isEqual:@"General News"])
    {

        Red *red = [[Red alloc] initWithNibName:@"NewsView2" bundle:nil];
        [self.navigationController pushViewController:red animated:YES];
        [red release];

    }

else if ([[array objectAtIndex:indexPath.row] isEqual:@"Traffic Reports"])
{
    Blue *blue = [[Blue alloc] initWithNibName:@"TrafficReports" bundle:nil];
    [self.navigationController pushViewController:blue animated:YES];
    [blue release];
}
else if ([[array objectAtIndex:indexPath.row] isEqual:@"Weather"])
{
    Blue *blue = [[Blue alloc] initWithNibName:@"WeatherView" bundle:nil];
    [self.navigationController pushViewController:blue animated:YES];
    [blue release];
}

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM