0

次のコードを使用しています

      self.imageView = [[UIImageView alloc] init];
  [self.imageView setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:@"profile-image-placeholder"]];
    [self setNeedsLayout];
    [self setNeedsDisplay];

ただし、 drawRect では、次を使用したプレースホルダーのみが画像を見ることができません

[self.imageView.image drawAtPoint:CGPointMake(15.0f, 5.0f)];

これに関するアイデアはありますか?

4

1 に答える 1

0

I think all you need to do is this. AFNetworking will cancel the image operation if the cell is reused so you don't need to worry about that edge case.

[self.imageView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]] placeholderImage:[UIImage imageNamed:@"profile-image-placeholder"] success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
      self.imageview.image=image;
      [self setNeedsLayout];
      [self setNeedsDisplay];

    } failure:nil];
于 2013-03-04T00:13:54.383 に答える