同步使用 FFImageLoading?
Using FFImageLoading Synchronously?
我需要同步使用 FFImageLoading ImageService class 的 LoadUrl 方法,因为它是在网格数据源的 CreateCell 方法中调用的。使用 Xamarin.iOS 和 c#。感谢快速解决方案。这是当前代码:
public override IGFlowLayoutViewCell CreateCell(IGFlowLayoutView flowLayoutView, nint index)
{
IGFlowLayoutViewCell cell = flowLayoutView.DequeueReusableCell("CELL") as IGFlowLayoutViewCell;
UIImageView iconImage = new UIImageView();
if (cell == null)
{
cell = new IGFlowLayoutViewCell("CELL");
cell.ContentInset = new UIEdgeInsets(2, 2, 2, 2);
cell.ContentMode = UIViewContentMode.Center;
cell.Layer.BorderColor = UIColor.LightGray.CGColor;
cell.Layer.BorderWidth = 1;
cell.ContentView = iconImage;
ImageService.LoadUrl(instrumentImageUrls[index], new TimeSpan(12, 0, 0))
.Into((UIImageView)cell.ContentView,0);
}
return cell;
}
public override IGFlowLayoutViewCell CreateCell(IGFlowLayoutView flowLayoutView, nint index)
{
IGFlowLayoutViewCell cell = flowLayoutView.DequeueReusableCell("CELL") as IGFlowLayoutViewCell;
UIImageView iconImage = new UIImageView();
if (cell == null)
{
cell = new IGFlowLayoutViewCell("CELL");
cell.ContentInset = new UIEdgeInsets(2, 2, 2, 2);
cell.ContentMode = UIViewContentMode.Center;
cell.Layer.BorderColor = UIColor.LightGray.CGColor;
cell.Layer.BorderWidth = 1;
cell.ContentView = iconImage;
ImageService.LoadUrl(instrumentImageUrls[index], new TimeSpan(12, 0, 0))
.IntoAsync((UIImageView)cell.ContentView,0).GetAwaiter().GetResult();
}
return cell;
}
我需要同步使用 FFImageLoading ImageService class 的 LoadUrl 方法,因为它是在网格数据源的 CreateCell 方法中调用的。使用 Xamarin.iOS 和 c#。感谢快速解决方案。这是当前代码:
public override IGFlowLayoutViewCell CreateCell(IGFlowLayoutView flowLayoutView, nint index)
{
IGFlowLayoutViewCell cell = flowLayoutView.DequeueReusableCell("CELL") as IGFlowLayoutViewCell;
UIImageView iconImage = new UIImageView();
if (cell == null)
{
cell = new IGFlowLayoutViewCell("CELL");
cell.ContentInset = new UIEdgeInsets(2, 2, 2, 2);
cell.ContentMode = UIViewContentMode.Center;
cell.Layer.BorderColor = UIColor.LightGray.CGColor;
cell.Layer.BorderWidth = 1;
cell.ContentView = iconImage;
ImageService.LoadUrl(instrumentImageUrls[index], new TimeSpan(12, 0, 0))
.Into((UIImageView)cell.ContentView,0);
}
return cell;
}
public override IGFlowLayoutViewCell CreateCell(IGFlowLayoutView flowLayoutView, nint index)
{
IGFlowLayoutViewCell cell = flowLayoutView.DequeueReusableCell("CELL") as IGFlowLayoutViewCell;
UIImageView iconImage = new UIImageView();
if (cell == null)
{
cell = new IGFlowLayoutViewCell("CELL");
cell.ContentInset = new UIEdgeInsets(2, 2, 2, 2);
cell.ContentMode = UIViewContentMode.Center;
cell.Layer.BorderColor = UIColor.LightGray.CGColor;
cell.Layer.BorderWidth = 1;
cell.ContentView = iconImage;
ImageService.LoadUrl(instrumentImageUrls[index], new TimeSpan(12, 0, 0))
.IntoAsync((UIImageView)cell.ContentView,0).GetAwaiter().GetResult();
}
return cell;
}