Objective C Custom Lazy Load Images UITableView Cell

前端 未结 2 2056
长情又很酷
长情又很酷 2020-12-21 16:31

First time loading remote images into an iPhone app, and would like some help optimizing the process. What I\'ve currently done is get the image if it doesn\'t exist, and ca

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-21 17:17

    Just having a quick look at your code - you seem to be pushing blocks onto asynchronous queues, but you are calling UI code in those blocks.

    You should only run UI code on the main thread.

    As for a solution - have a look at some of the open source implementations to either give you an idea of what you should be doing, or just use them directly.

    One such is AsyncImageView on Github.

    There are others that a quick search will bring up.

提交回复
热议问题