How to load UIImage from web URL ?

How to load UIImage from web URL ?

UIImage img=Images.Fromuri("");

Common Class :

public static Class Images
Public static UIImage FromUrl (string uri)
using (var url = new NSUrl (uri))
using (var data = NSData.FromUrl (url))
return UIImage.LoadFromData (data);
How to choose a photo From Phone album?

In Xamarin.iOS Application for choose a photo from album .we need to use UIImagePickerController

Follow below step for show photo album Controller

1. Create the image picker control

Var Imagepicker=new UIImagePickerController();

2. Set the Source and media Type

Imagepicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;

Imagepicker.MediaTypes = UIImagePickerController.AvailableMediaTypes (UIImagePickerControllerSourceType.PhotoLibrary);

3.Create Delegate event for image chose & cancel image selection.

Imagepicker.FinishedPickingMedia += Handle_FinishedPickingMedia;

Imagepicker.Canceled += Handle_Canceled;

4.Show Image controller

NavigationController.PresentModalViewController(Imagepicker, true);

5. Implement Image choose event

protected void Handle_FinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e)
// determine what was selected, video or image
bool isImage = false;
switch(e.Info[UIImagePickerController.MediaType].ToString()) {
case "public.image":
// get the original image
UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage;
if(originalImage != null) {
// do something with the image
Console.WriteLine ("got the original image");
imageView.Image = originalImage; // display
case "":
Console.WriteLine("Video selected");
// dismiss the picker
imagePicker.DismissModalViewControllerAnimated (true);
6 .Cancel Image controller
void Handle_Canceled (object sender, EventArgs e) {
3. Which controller we can use for Phone photo album access?



Featured Post

Understanding about Azure Region, Geographies, Availability Zones and Region Pairs

Introduction Microsoft Azure services are available in 53 regions around the world, with plans announced for 7 additional regions and 140+ a...

Subscribe to the FREE Weekly Newsletter to receive all the latest Microsoft Azure, AI, Xamarin

Popular Posts