Я добавил IBOutlet UIActivityIndicator в пользовательскую ячейку, но он не отображается в каждой ячейке, только в первых 2-3, а затем ничего. Другое дело, когда я прокручиваю таблицу и возвращаюсь к первым 3 ячейкам, UIActivityIndicator тоже исчезает из этих ячеек...
Код:
Ячейка.ч
@interface Cell : UITableViewCell
@property (strong, nonatomic) IBOutlet UIImageView *image;
@property (strong, nonatomic) IBOutlet UILabel *label;
@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator;
@end
Сот.м
@implementation Cell
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
// change to our custom selected background view
}
return self;
}
@end
В раскадровке UIactivityIndicator имеет значение: Поведение: - Анимация
в целях тестирования...
а также:
- (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;
}