Quote:
Originally Posted by gud4nuthin
try this
in cell
Code:
NSString *url1 = [NSString stringWithFormat:@"%@", aBook.image];//having image info
NSString* url = [url1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"String = %@",url1);
NSURL *imageURL = [NSURL URLWithString:url];
NSLog(@"urlString = %@",imageURL);
NSData *data = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [[UIImage alloc] initWithData:data];
[imgView setImage:image];
|
Thanks, Gud4nuthin- I'm getting there!
I get no errors but my console log says
String = (null)
urlString = (null)
Does this mean the url i'm parsing doesn't have images? It does, so I assume I'm off somewhere else. Again, the articles parse and load fine, no problem.
// Set up the cell
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.textColor = [UIColor colorWithRed:153.0/255.0 green:202.0/255.0 blue:60.0/255.0 alpha:1.0];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.textColor = [UIColor colorWithRed:153.0/255.0 green:202.0/255.0 blue:60.0/255.0 alpha:1.0];
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
[cell.textLabel setText:[[stories objectAtIndex: storyIndex] objectForKey: @"title"]];
[cell.detailTextLabel setText:[[stories objectAtIndex: storyIndex] objectForKey: @"summary"]];
NSString *url1 = [NSString stringWithFormat:@"%@", currentImage];//having image info
NSString* url = [url1 stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"String = %@",url1);
NSURL *imageURL = [NSURL URLWithString:url];
NSLog(@"urlString = %@",imageURL);
NSData *data = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [[UIImage alloc] initWithData:data];
[imageView setImage:image];