• <bdo id='ux71d'></bdo><ul id='ux71d'></ul>
  1. <legend id='ux71d'><style id='ux71d'><dir id='ux71d'><q id='ux71d'></q></dir></style></legend>
    1. <i id='ux71d'><tr id='ux71d'><dt id='ux71d'><q id='ux71d'><span id='ux71d'><b id='ux71d'><form id='ux71d'><ins id='ux71d'></ins><ul id='ux71d'></ul><sub id='ux71d'></sub></form><legend id='ux71d'></legend><bdo id='ux71d'><pre id='ux71d'><center id='ux71d'></center></pre></bdo></b><th id='ux71d'></th></span></q></dt></tr></i><div id='ux71d'><tfoot id='ux71d'></tfoot><dl id='ux71d'><fieldset id='ux71d'></fieldset></dl></div>

    2. <small id='ux71d'></small><noframes id='ux71d'>

      <tfoot id='ux71d'></tfoot>

      使用 RestKit 从 NSURL 异步加载图像

      Load images from NSURL async with RestKit(使用 RestKit 从 NSURL 异步加载图像)
        <tbody id='BLCLo'></tbody>

      1. <i id='BLCLo'><tr id='BLCLo'><dt id='BLCLo'><q id='BLCLo'><span id='BLCLo'><b id='BLCLo'><form id='BLCLo'><ins id='BLCLo'></ins><ul id='BLCLo'></ul><sub id='BLCLo'></sub></form><legend id='BLCLo'></legend><bdo id='BLCLo'><pre id='BLCLo'><center id='BLCLo'></center></pre></bdo></b><th id='BLCLo'></th></span></q></dt></tr></i><div id='BLCLo'><tfoot id='BLCLo'></tfoot><dl id='BLCLo'><fieldset id='BLCLo'></fieldset></dl></div>
        • <legend id='BLCLo'><style id='BLCLo'><dir id='BLCLo'><q id='BLCLo'></q></dir></style></legend>

          <small id='BLCLo'></small><noframes id='BLCLo'>

          <tfoot id='BLCLo'></tfoot>
          • <bdo id='BLCLo'></bdo><ul id='BLCLo'></ul>

                本文介绍了使用 RestKit 从 NSURL 异步加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                RestKit 中是否有包装器或某种内置功能可以使用回调或异步方式从 NSURL 加载 UIImage块?我在 RestKit 文档中找不到这样的方法.如果没有,从 NSURL 使用 RestKit 尽可能实现延迟加载异步图像的好策略是什么?

                Is there a wrapper or some sort of built-in functionality available in RestKit to load a UIImage from an NSURL asynchronously using callbacks or blocks? I could not find such a method in the RestKit docs. If there is not, what is a good strategy for implementing lazy loaded async images from NSURL using RestKit as much as possible?

                推荐答案

                使用RestKit你可以使用RKRequest来为图片加载数据,例如:

                Using RestKit you can use RKRequest to load the data for the image in a manner such as:

                RKRequest* request = [RKRequest requestWithURL: url];
                
                request.onDidLoadResponse = ^(RKResponse* response) {
                    UIImage* image = [UIImage imageWithData: response.body];
                    // do something interesting with the image
                };
                
                request.onDidFailLoadWithError = ^(NSError* error) {
                    // handle failure to load image
                }
                
                [imageLoadingQueue addRequest: request];
                

                请注意,即使在 onDidLoadResponse 情况下,您也可能需要检查 response 以确保数据类型符合您的预期.上面使用的图片加载队列可以这样创建:

                Note that even in the onDidLoadResponse case you may want to check response to make sure the type of data is what you expected. The image loading queue used above can be created like so:

                imageLoadingQueue = [RKRequestQueue requestQueueWithName: @"imageLoadingQueue"];
                [imageLoadingQueue start];
                

                这篇关于使用 RestKit 从 NSURL 异步加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                Difference between retain and copy?(保留和复制的区别?)
                Can`t copy file from bundle to documents directory in iOS(无法将文件从捆绑包复制到 iOS 中的文档目录)
                Automatically copy property values from one object to another of a different type but the same protocol (Objective-C)(自动将属性值从一个对象复制到另一个类型不同但协议相同的对象 (Objective-C))
                What is the difference between quot;copyquot; and quot;retainquot;?(“复制和“复制有什么区别?和“保留?)
                Copy text to clipboard with iOS(使用 iOS 将文本复制到剪贴板)

                1. <i id='ZJ73n'><tr id='ZJ73n'><dt id='ZJ73n'><q id='ZJ73n'><span id='ZJ73n'><b id='ZJ73n'><form id='ZJ73n'><ins id='ZJ73n'></ins><ul id='ZJ73n'></ul><sub id='ZJ73n'></sub></form><legend id='ZJ73n'></legend><bdo id='ZJ73n'><pre id='ZJ73n'><center id='ZJ73n'></center></pre></bdo></b><th id='ZJ73n'></th></span></q></dt></tr></i><div id='ZJ73n'><tfoot id='ZJ73n'></tfoot><dl id='ZJ73n'><fieldset id='ZJ73n'></fieldset></dl></div>
                    • <bdo id='ZJ73n'></bdo><ul id='ZJ73n'></ul>

                      • <legend id='ZJ73n'><style id='ZJ73n'><dir id='ZJ73n'><q id='ZJ73n'></q></dir></style></legend>

                        <small id='ZJ73n'></small><noframes id='ZJ73n'>

                          <tbody id='ZJ73n'></tbody>
                      • <tfoot id='ZJ73n'></tfoot>