I have added an IBOutlet of UIActivityIndicator to custom cell but it doesn't show on every cell, just on first 2-3 and then nothing. Another thing, when I scroll the table and get back too first 3 cells, UIActivityIndicator disappears from these cells too...
Code:
Cell.h
@interface Cell : UITableViewCell
@property (strong, nonatomic) IBOutlet UIImageView *image;
@property (strong, nonatomic) IBOutlet UILabel *label;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
@end
Cell.m
@implementation Cell
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
// change to our custom selected background view
}
return self;
}
@end
In storyboard UIactivityIndicator is set to: Behavior: - Animating
for testing purposes...
and:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCell";
Cell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// load the image for this cell
Wallpaper *wallpaper = [xmlParser.wallpapers objectAtIndex:indexPath.row];
cell.label.text = wallpaper.title;
NSString *imageToLoad = wallpaper.thumbnail;
[cell.image setImageWithURL:[NSURL URLWithString:imageToLoad] placeholderImage:nil options:SDWebImageProgressiveDownload progress:^(NSUInteger receivedSize, long long expectedSize)
{
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)
{
//[cell.activityIndicator stopAnimating];
}];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(tapped:)];
[cell.image addGestureRecognizer:tap];
[cell.image setTag:indexPath.row];
CALayer * l = [cell.image layer];
[l setMasksToBounds:YES];
[l setCornerRadius:5.0];
cell.layer.cornerRadius = 7.0;
return cell;
}