1

I want to load gif image in UIImageView. I've try to use it wih FLAnimatedImage but it not worked. I have taken imageview in storyboard and added gif to resources.

Divyesh
  • 2,085
  • 20
  • 35

2 Answers2

2

If you want to load gif image with UIImageView, I find one article that you can take a look:

https://montemagno.com/animated-gif-uiimageview-in-xamarinios/

Cherry Bu - MSFT
  • 10,160
  • 1
  • 10
  • 16
  • when I use this, my app starts to run slow, using it to search through a list of gifs and it's really slow. – Eman Sep 10 '21 at 20:39
1

If you try to create the gif using individual images, it will be easier, as you can see here. When you convert the native code from here to C#, you get this

UIImageView gifView = new UIImageView();
gifView.AnimationImages = new UIImage[] {
    UIImage.FromBundle("Image1.png"),
    UIImage.FromBundle("Image2.png"),
    UIImage.FromBundle("Image3.png"),
    UIImage.FromBundle("Image4.png")
};
gifView.AnimationRepeatCount = 0; // Repeat forever.
gifView.AnimationDuration = 1.0; // Every 1s.
gifView.StartAnimating();
gifView.View.Frame = new CoreGraphics.CGRect(0, 20, this.View.Bounds.Size.Width, 180); // size of the animation
this.View.AddSubview(gifView);
Saamer
  • 4,687
  • 1
  • 13
  • 55
  • If you want to add a gif from a URL, you could try to use this https://montemagno.com/animated-gif-uiimageview-in-xamarinios/ – Saamer Jun 07 '19 at 16:56
  • thanks for the replay I know this way, but I want to use single gif with UIImageView not want to use multiple images and create animation – Divyesh Jun 08 '19 at 06:34
  • @Divyesh_008 there's no way of doing that unfortunately – Saamer Jan 10 '20 at 22:51