首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >同步使用FFImageLoading?

同步使用FFImageLoading?
EN

Stack Overflow用户
提问于 2016-05-06 15:34:49
回答 1查看 416关注 0票数 0

我需要同步使用FFImageLoading ImageService类的CreateCell方法,因为它是在网格数据源的CreateCell方法中调用的。使用Xamarin.iOS和c#。感谢一个快速的解决方案。以下是当前代码:

代码语言:javascript
复制
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;
        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-02 23:18:24

代码语言:javascript
复制
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;
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37076284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档