views:

22

answers:

1

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.

A: 

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

}

Morry
You've got exactly the right idea. One thing though- you don't need to call `deselectRowAtIndexPath` if you're pushing a new view controller onto the navigation controller.
Rob Lourens