我无法从 iOS 上的 ImageCached 对象加载图像。
我从那里获得了一个资产库 url,ALAsset
但是当我创建 ImageCached 对象时,它不会显示图像,并以找不到文件的错误结尾。
我从(ALAsset)asset.AssetUrl.AbsoluteString
这是初始化我的 CachedObject 的代码
CachedImage image = new CachedImage();
image.Source = url;
image.HeightRequest = heightRequest;
image.WidthRequest = widthRequest;
image.DownsampleWidth = downSample;
image.CacheDuration = TimeSpan.FromDays(30);
image.LoadingPlaceholder = "Images/loading_grey.png";
image.ErrorPlaceholder = "Images/placeholder.png";
image.Transformations = new System.Collections.Generic.List<ITransformation>() {
new CropTransformation(1, image.Width / 2 - heightRequest, image.Height / 2 - widthRequest)
};
image.CacheType = FFImageLoading.Cache.CacheType.Disk;
image.GestureRecognizers.Add(new TapGestureRecognizer
{
Command = new Command(() => {
Navigation.PushModalAsync(new ViewImagePage(url));
}),
NumberOfTapsRequired = 1
});
return image;
从另一个帖子中,当我浏览我的图像时,我得到了一个线索
ImagesNames.Add(asset.DefaultRepresentation.Url.AbsoluteString);