NSDictionary *temp = [self.placeArray objectAtIndex:[indexPath row]];
cell.textLabel.text = [temp objectForKey:@"name"];
UILabel *detailLbl = [[UILabel alloc]initWithFrame:CGRectMake(250,0,200,50)];
[detailLbl setText:[temp objectForKey:@"distance"]];
[cell.contentView addSubview:detailLbl];
cell.imageView.image =[UIImage imageNamed:[temp objectForKey:@"category"]];
On the last line i have set the image , but enable to see the image . please help me with this . And i can also not being able to unable segue .
when you loading image from URL but no local,your tableView has drawrect,so when the image finish loading,you must reload tableView or reload the row .
you can use lazy load to get your image. start an request to get image in background,and callback use an block to set image.
this links can help you: https://github.com/rs/SDWebImage
How do you have define your cell? In some cases using:
initWithStyle:UITableViewCellStyleDefault
instead:
initWithStyle:UITableViewCellStyleValue1
had fixing the issue for me.
Try like this
NSString *imgUrl = @""; //enter your url here
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imgUrl]];
UIImage *img = [UIImage imageWithData:data];
cell.imageView.image = img;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.