• <legend id='7qzLo'><style id='7qzLo'><dir id='7qzLo'><q id='7qzLo'></q></dir></style></legend>

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

      1. <tfoot id='7qzLo'></tfoot>

        UIImage 从服务器逐步显示

        时间:2023-07-08
      2. <legend id='hUVxH'><style id='hUVxH'><dir id='hUVxH'><q id='hUVxH'></q></dir></style></legend>

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

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

              <tbody id='hUVxH'></tbody>
                <bdo id='hUVxH'></bdo><ul id='hUVxH'></ul>

              • <tfoot id='hUVxH'></tfoot>

                  本文介绍了UIImage 从服务器逐步显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在尝试显示来自服务器的大图像,但我必须逐步显示它.

                  我使用了 UIView 的子类,其中我使用了 UIImage 对象,其中我使用了 NSURLConnection 及其委托方法,我也使用了

                  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;

                  我在其中添加数据并将其转换为 UIImage 对象,并使用 UIImagedrawInRect: 方法绘制矩形.p>

                  一切正常,但问题是,当在上下文中绘制图像时,在将整个图像绘制到屏幕上之前,我无法单击屏幕上的其他任何位置.

                  有什么好的解决方案,即使在屏幕上绘制图像,我也可以点击其他任何地方?

                  任何帮助都将不胜感激.

                  didReceiveData 中是否有任何有效的方法来逐步绘制模糊图像?所以 drawInRect 不会花费太多时间来绘制.或者,如果有人有自定义的 drawRect 方法,该方法可以有效地将图像逐渐显示为在 didReceiveData 中接收到的数据.

                  解决方案

                  我用过 NYXImagesKit 做类似的事情,在不阻塞主线程的情况下下载图像并逐步显示图像.我写了一个非常快速和肮脏的例子来说明基本的工作原理.我在 UITableview 中加载图像以显示它不会阻塞用户界面(主线程).您可以在图像加载时滚动表格视图.不要忘记添加正确的框架,有几个.这是 Github 上项目的链接:

                  https://github.com/HubertK/ProgressiveImageDownload

                  它真的很容易使用,创建一个 NYXProgressiveImageView 对象,设置 URL,它会在您调用时为您完成所有工作:

                  loadImageAtURL:

                  它是 UIImageView 的子类,像魔术一样工作!这是开发者网站的链接:

                  http://www.cocoaintheshell.com/2012/01/nyximageskit-class-nyxprogressiveimageview/

                  I have been trying to display large image from server, but I have to display it progressively.

                  I used subclass of UIView and in that I have taken UIImage object, in which I used NSURLConnection and its delegate methods, I also used

                  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
                  

                  in which I am appending data and converting it to UIImage object, and drawing rect using the drawInRect: method of UIImage.

                  Everything is working fine, but the problem is, when image is being drawn on context, I cannot click anywhere else on screen until entire image is being drawn on to screen.

                  Is there any good solution, where I can click anywhere else even if image is being drawn on screen?

                  Any help will be appreciable.

                  Edit: Is there any efficient way of drawing image blurry progressively in didReceiveData? so drawInRect does not take too much time to draw. Or If anyone has custom drawRect method which efficiently displays image progressively as data received in didReceiveData.

                  解决方案

                  I have used NYXImagesKit for something similar, downloading images while not blocking the main thread and showing the image progressively. Ive written a really quick and dirty example to illustrate the basic workings. I load the image in a UITableview to show that it doesn't block the User Interface(Main Thread). You can scroll the tableview while the image is loading. Don't forget to add the correct Frameworks, there are a few. Heres the link to the project on Github:

                  https://github.com/HubertK/ProgressiveImageDownload

                  It's really easy to use,create a NYXProgressiveImageView object, set the URL and it will do all the work for you when you call:

                  loadImageAtURL:
                  

                  It's a subclass of UIImageView, Works like magic! Here's a link to the developers site:

                  http://www.cocoaintheshell.com/2012/01/nyximageskit-class-nyxprogressiveimageview/

                  这篇关于UIImage 从服务器逐步显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:HTTP“内容处置:附件"并在 iOS 网络浏览器上下载文件 下一篇:HTTP 参数和 HTTP 标头有什么区别?

                  相关文章

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

                    <small id='98bvR'></small><noframes id='98bvR'>

                    1. <legend id='98bvR'><style id='98bvR'><dir id='98bvR'><q id='98bvR'></q></dir></style></legend>
                      • <bdo id='98bvR'></bdo><ul id='98bvR'></ul>