I have a project in which I have to insert an image from JSON. I am trying to find any tutorial about this, try to watch any video from this topic, but nothing. So I have a problem:
-(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webdata options:0 error:nil]; NSDictionary *playlist =[allDataDictionary objectForKey:@"playlist_data"]; for (NSDictionary *diction in playlist) { NSString *name = [diction objectForKey:@"text1"]; NSString *namesong = [diction objectForKey:@"text2"]; NSString *images = [diction objectForKey:@"image"]; NSLog(@"%@", images); [array addObject:text1]; [array2 addObject:text2]; } [[self tableTrack]reloadData]; }
I added text 1 to the cell, and text 2 its work was perfect, but how to add the image to array 3 (the image in the cell in my TableView)? I also tried adding an image, but it does not work for me:
NSURL *imageURL = [NSURL URLWithString:[appsdict objectForKey:@"image"]]; NSData *imageData = [NSData dataWithContentsOfURL:imageURL]; UIImage *imageLoad = [[UIImage alloc] initWithData:imageData]; cell.imageView.image = imageLoad;
Please help with my problem or maybe give some tutorial with parsing from JSON, also youtube doesn't have a perfect tutorial from JSON parsing. Thanks!
source share