loading image in UITableViewCell asynchronously

前端 未结 2 2120
旧时难觅i
旧时难觅i 2021-02-11 07:52

What is the super very easy way to load the image in the UITableViewCell asynchronously say given a imageURL without having to subclassing the UITableViewCell, i.e: standard UIT

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-11 08:19

    The easiest way I know is to use SDWebImage library. Here is a link that explains how to utilize the SDWebImage library to load avatars asynchronously.

    SDWebImage is an extension to the ImageView. Here is the usage:

    // load the avatar using SDWebImage
        [cell.imageView setImageWithURL:[NSURL URLWithString:tweet.profileImageUrl]
                       placeholderImage:[UIImage imageNamed:@"grad_001.png"]];
    

    And here is the referenced article:

    Implementing Twitter Search

提交回复
热议问题