Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vund0

macrumors newbie
Original poster
Oct 28, 2009
4
0
Hello, I have an array that I populated with my plist file, which looks something like this:
Code:
<array>
   <string>http://www.apple.com</string>
   <string>http://www.google.com</string>
   <string>http://www.amazon.com</string>
</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:
Code:
- (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:
Code:
- (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];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.