I have a storyboard with two labels in a UITableViewCell
.
title and price.
In my ViewController.m
I have an array with data(from a url in JSON). I get all I need BUT when I want to add this data into the label, I tried something like this:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = @"BasicCell"; UITableViewCell *myCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
// Get the location to be shown Location *item = _feedItems[indexPath.row]; NSString *baseUrl = @"address/to/image"; NSString *urlString = [baseUrl stringByAppendingString:item.thumbnail]; NSURL *urla = [NSURL URLWithString:urlString]; NSData * imageData = [NSData dataWithContentsOfURL:urla]; UIImage * image = [UIImage imageWithData:imageData];
myCell.imageView.image = image;
myCell.detailTextLabel.text = item.elementid; // "No visible @interface for 'Location' declares the selector 'objectAtIndex:' myCell.textLabel.text = item.element; //"No visible @interface for 'Location' declares the selector 'objectAtIndex:'
return myCell; }
It does not work and I don't know why. I didn't receive any error message. Can anyone help me?