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.
开发者_C百科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];
}
}
精彩评论