Set UIImageView image using a url

后端 未结 10 722
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 02:24

Is it possible to read a url to an image and set a UIImageView to the image at this url?

10条回答
  •  死守一世寂寞
    2020-12-08 03:04

    Unfortunately this feature is not available as of this writing... instead you will have to implement the functionality yourself by:

    1. Downloading the data of the image
    2. Saving it or caching it somewhere (db or filesystem) and then
    3. Setting the UIImaveView to the saved structure

    Fortunately you don't have to break your head coming out with said functionality as Apple provides an example that does exactly that as part of their code samples.

    Follow the code and I'm sure you will be able to accommodate it to your needs.

提交回复
热议问题