首页 文章

Xamarin表单FFImageLoading图像未显示

提问于
浏览
1

我正在尝试在我们的一个Xamarin Forms项目中使用 FFImageLoading ,但我遇到了一些奇怪的问题 .

当我尝试将 Sources="anyvalidimageurl" 放在XAML上时,我收到此错误:

无效的XAML:值不能为空 . 参数名称:'obj'

这是XAML:

<ffimageloading:CachedImage HorizontalOptions="Center" 
            WidthRequest="300" 
            HeightRequest="300"
            DownsampleToViewSize="true"
            Source="http://myimage.com/image.png"
            x:Name="imgImage">
</ffimageloading:CachedImage>

我试图通过代码加载图像,但iOS上没有显示图像 .

2 回答

  • 0

    您需要将其添加到AppDelegate.cs

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            FFImageLoading.Forms.Touch.CachedImageRenderer.Init();
            var dummy = new FFImageLoading.Forms.Touch.CachedImageRenderer();
    
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
    
            return base.FinishedLaunching(app, options);
        }
    

    有关更多信息,请参阅https://github.com/luberda-molinet/FFImageLoading/issues/55

  • 2

    你错过了包含CachedImageRenderer.Init();在AppDelegate.cs中

相关问题