V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Ixizi
V2EX  ›  iDev

图片边加载边显示,类似浏览器有什么解决方案

  •  
  •   Ixizi · 2015-10-19 00:00:22 +08:00 · 3472 次点击
    这是一个创建于 3083 天前的主题,其中的信息可能已经有所发展或是发生改变。
    图片一点一点加载。从不清晰的像素点加载到完整图片,或者从上往下加载…

    然后我想要用在 cell 中…
    我网络断了,我显示半个未加载完的图片在那。
    6 条回复    2015-10-19 12:57:54 +08:00
    qq286735628
        1
    qq286735628  
       2015-10-19 00:04:22 +08:00   ❤️ 1
    这是 JPEG 格式的特性,用 PS 导出的时候,勾上‘连续’即可

    http://image.zhangxinxu.com/image/blog/201301/2013-01-07_181001.png

    详情搜一下渐进式 JPEG
    lightforce
        2
    lightforce  
       2015-10-19 00:34:42 +08:00
    progressive feature
    loveuqian
        3
    loveuqian  
       2015-10-19 00:49:11 +08:00 via iPhone
    @qq286735628 学习了
    ibremn
        4
    ibremn  
       2015-10-19 01:03:30 +08:00
    progressive/interlaced 是只由模糊变清晰,这个需要图片本身处理过,网上这种图片比较少。
    一般图片默认是 baseline 的,即逐行加载。
    下面这段代码可以支持 baseline/progressive/interlaced JPEG/PNG/GIF :

    CGImageSourceRef source = CGImageSourceCreateIncremental(NULL);
    while (dataArrived) {
    CGImageSourceUpdateData(source, (__bridge CFDataRef)data, false);
    if (CGImageSourceGetCount(source) > 0) {
    CGImageRef imageRef = CGImageSourceCreateImageAtIndex(source, 0, NULL);
    UIImage *image = [UIImage imageWithCGImage:imageRef scale:screenScale];
    /// display
    }
    }
    sneezry
        5
    sneezry  
       2015-10-19 03:10:39 +08:00 via iPhone
    png 也是支持的, ps 里勾选“交错”
    xuzhongzhou
        6
    xuzhongzhou  
       2015-10-19 12:57:54 +08:00
    [Concorde]( https://github.com/contentful-labs/Concorde.git) Download and decode progressive JPEGs on iOS.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3277 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 13:10 · PVG 21:10 · LAX 06:10 · JFK 09:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.