I tried this link, but I didn't get my solution.
I want to display and load images from URL that are visible in UITableViewCell
and other cell images have to load when we scroll table view in Objective-C.
I tried this link, but I didn't get my solution.
I want to display and load images from URL that are visible in UITableViewCell
and other cell images have to load when we scroll table view in Objective-C.
use SDWebImage for this. it has almost all features what you need. It's also easy to coding like this.
Objective C
[imageView sd_setImageWithURL:[NSURL URLWithString:@"your domain"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
Additional:
swift 3:
imageView.sd_setImage(with: URL(string: "your domain"), placeholderImage: UIImage(named: "placeholder.png"))
Rajashekar simply you can do this
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *strCell=@"cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:strCell];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:strCell];
}
NSString *strImgURL = @"YourImageURL";
NSError* error = nil;
NSURL *fileURL = [NSURL fileURLWithPath:strImgURL];
NSData* data = [NSData dataWithContentsOfURL:fileURL options:NSDataReadingUncached error:&error];
if (error) {
NSLog(@"%@", [error localizedDescription]);
} else {
NSLog(@"Data has loaded successfully.");
}
UIImage *img = [[UIImage alloc] initWithData:data];
cell.imageView.image = img;
return cell;
}