views:

273

answers:

0

Hello, I have an array that I populated with my plist file, which looks something like this:

<array>
   <string>http://www.apple.com&lt;/string&gt;
   <string>http://www.google.com&lt;/string&gt;
   <string>http://www.amazon.com&lt;/string&gt;
</array>

So, I'm looking to convert these NSString objects to NSURL objects when I call them in my didSelectRowAtIndexPath method. Any ideas?

This is what I have right now:

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


     NSInteger row = [indexPath row];

     if (self.viewController == nil) {
          TemplateViewController *details = [[TemplateViewController alloc] initWithNibName:@"TemplateViewController" bundle:nil];
          self.viewController = details;
          [details release];
     }


     NSString *tempURLString = [tieroneurlArray objectAtIndex:row];
     NSURL *loadingUrl = [NSURL URLWithString:tempURLString];
     [tieroneurlArray addObject:loadingUrl];

     viewController.title = [NSString stringWithFormat:@"%@", [tieroneArray objectAtIndex:row]];

     [self.viewController setTableURL:[tieroneurlArray objectAtIndex:row]];     

     TemplateAppAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
     [delegate.templateNavController pushViewController:viewController animated:YES];
}

And this is how I load the array with the plist:

- (void)viewDidLoad {
    [super viewDidLoad];

     NSString *path = [[NSBundle mainBundle] pathForResource:@"tier1Names" ofType:@"plist"];
     tieroneArray = [[NSMutableArray alloc] initWithContentsOfFile:path];

     NSString *tableURL = [[NSBundle mainBundle] pathForResource:@"tier1URL" ofType:@"plist"];     
     tieroneurlArray = [[NSMutableArray alloc] initWithContentsOfFile:tableURL];
}