Я успешно загружаю миниатюры из сообщений в асинхронном порядке в свой UITableView.
Проблема, с которой я сталкиваюсь, заключается в том, что изображения появляются только в том случае, если я нажимаю на ячейку или если я прокручиваю вниз.
Когда я нажимаю на ячейку, изображение появляется слева, нажимая заголовок и субтитры вправо.
Когда я прокручиваю вниз, изображения появляются там, где они должны быть в ячейках, когда они отображаются.
Здесь мой код (я использую AFNetworking):
#import "UIImageView+AFNetworking.h"
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return posts.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSDictionary *post = [posts objectAtIndex:indexPath.row];
NSString *postpictureUrl = [post objectForKey:@"picture"];
[cell.imageView setImageWithURL:[NSURL URLWithString:postpictureUrl]];
cell.textLabel.text = [post objectForKey:@"post_text"];
cell.detailTextLabel.text = [post objectForKey:@"post_author_name"];
return cell;
}
Я вижу это в симуляторе iPhone 6.0, XCode 4.5, OSX MtLion.
Любые идеи, почему изображения не отображаются на начальном экране?