我无法从iOS上的ImageCached对象加载图片。
我从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);