UIImage loaded from URL in Xamarin / C#

前端 未结 5 981
情歌与酒
情歌与酒 2021-02-01 17:07

It has been 4 years since this question has been answered with this blog post.

Is there a standard way to create a UIImage with an image from a URL? Something like:

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 17:56

    I tried the above, it looks like a great idea, but I get: Cannot implicitly convert type System.Threading.Tasks.Task' toMonotouch.UIKit.UIImage'

    [found a solution] The problem was because the
    obj.Image = await this.LoadImage (imageUrl) must also be in a method marked async. Then it works!

    Thanks

提交回复
热议问题