我需要同步使用FFImageLoading ImageService类的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;
}
答案 0 :(得分:0)
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;
}