Forum Xamarin.Mac


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to use UIImage (type/namespace not found)

SFBSamosSFBSamos USMember


Being a total beginner with Xamarin on mac, I was aiming to create a simple app that would retrieve a picture from the internet and show it in an NSImageView.

I followed the Microsoft tutorial Getting started - Hello, Mac – Walkthrough to get started and later figured out how to add the image view component. No problem here. But when I add the following code in my ViewController class:

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

I get the following error message:
error CS0246: The type or namespace name 'UIImage' could not be found (are you missing a using directive or an assembly reference?)

I can't figure out what reference to add to be able to use this type ?

As far as I can tell, Visual Studio is updated, as well my macs OS (Catalina).

Thanks for your time,

Best Answer


  • SFBSamosSFBSamos USMember

    Yep, replaced with NSImage, worked! Thanks a lot.

Sign In or Register to comment.