How to load image from remote server on the UIImageView in iphone?

前端 未结 1 667
青春惊慌失措
青春惊慌失措 2021-01-13 07:39

I am trying to load image from a remote server on the UIImageView in my application. Is it possible to load image from a remote server. I am using the following code

<
相关标签:
1条回答
  • 2021-01-13 08:16

    you got almost all the way there... now just

    imageView.image = img;
    

    note that using dataWithContentsOfURL will block your user interface while the image loads, which will work if you're loading small images at startup, but is generally a bad idea; look into NSURLConnection.

    0 讨论(0)
提交回复
热议问题