views:

34

answers:

1

DetailViewController.m

Code:

- (void)viewDidLoad {   
    [super viewDidLoad];
    NSString *navTitle = self.navigationItem.title;
    NSString *stalklabel = self.labelforurl.text;
    NSLog(@"%@", stalklabel);
    NSURL *address = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.twostepmedia.co.uk/json.php?q=%@",stalklabel]];
    responseData = [[NSMutableData data] retain];   
    NSURLRequest *request = [NSURLRequest requestWithURL:address];
    [[NSURLConnection alloc] initWithRequest:request delegate:self];

    //NSString *address = [NSString stringWithFormat:@"http://www.twostepmedia.co.uk/json.php?q=%@",na];
    //[self initiateRequest:address];
    //NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:address]];

    //[[NSURLConnection alloc] initWithRequest:request delegate:self];   

}

RootViewController.m

Code:

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

    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    //Initialize the detail view controller and display it.
    DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:dvController animated:YES];
    NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
    dvController.navigationItem.title=[[managedObject valueForKey:@"data"] description];
    dvController.labelforurl.text = [[managedObject valueForKey:@"data"] description];
    [dvController release];
    dvController = nil;
}

The output of NSLOG is "Label"?? So when i try and embed it in the URL, it only comes back with "Label"??

Any ideas?

A: 

In InterfaceBuilder, or somewhere in code, your labelforurl has a value of Label. Change this value for a different result. If you want to change it in IB, use a UITextField instead of a UIlabel.

Jordan