UIImage loaded from URL in Xamarin / C#

c#, ios, uiimage, xamarin, xamarin.ios

Solution

Not a one-liner, but with very few lines you can roll your own. E.g.

static UIImage FromUrl (string uri)
{
    using (var url = new NSUrl (uri))
    using (var data = NSData.FromUrl (url))
        return UIImage.LoadFromData (data);
}

The calls, including the one from `UIImage`, are thread-safe.

Problem

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: ``` UIImage image = UIImage.FromFile("http://foo.com/bar.jpg"); ``` I feel like I'm probably missing something really simple.

Original source

Related problems