views:

3

answers:

0

i am reading through sam's 24 hours to iphone programming. it's a really nice book with great examples, but as all programming goes, there's more ways than one to accomplish something.

i am basically trying to build a uitableview that once a row is selected will open a local file in a uiwebview (detailcontroller).

the book example builds this for external url:

// Override to support row selection in the table view.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

   FlowerDetailViewController *flowerDetailViewController = 
        [[FlowerDetailViewController alloc] initWithNibName:
         @"FlowerDetailViewController" bundle:nil];
   flowerDetailViewController.detailURL=
        [[NSURL alloc] initWithString: 
        [[[flowerData objectAtIndex:indexPath.section] objectAtIndex: 
          indexPath.row] objectForKey:@"url"]];
   flowerDetailViewController.title=
        [[[flowerData objectAtIndex:indexPath.section] objectAtIndex: 
          indexPath.row] objectForKey:@"name"];
   [self.navigationController pushViewController:
        flowerDetailViewController animated:YES];
   [flowerDetailViewController release];

}

and the row is called like so:

[redFlowers addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Poppy",@"name", @"poppy.png",@"picture", @"http://en.wikipedia.org/wiki/Poppy",@"url",nil]];

ideally i would like this:

[redFlowers addObject:[[NSMutableDictionary alloc]
                       initWithObjectsAndKeys:@"Poppy",@"name",
                       @"poppy.png",@"picture",
                 --->>     @"testfile.html",@"url",nil]];

which i know is not possible, but how could i do it, without rewriting everything?