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
xi_lin
V2EX  ›  iDev

UIWebView 如何支持类似微信的显示时才加载图片呢?

  •  
  •   xi_lin · 2015-11-18 12:32:20 +08:00 · 2653 次点击
    这是一个创建于 3084 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我在 UITableViewCell 中添加了一个 UIWebView ,通过 loadString 的方法加载了网页内容,但是直到所有图片都加载完成后才能收到 webViewDidFinishLoad 回调后进行 frame 调整。同时一次加载所有图片感觉也比较浪费。

    不知道有没有什么好方法可以做到类似微信公众号阅读时的滚动到才加载图片?
    6 条回复    2015-11-18 19:26:32 +08:00
    Sunnyyoung
        1
    Sunnyyoung  
       2015-11-18 13:42:21 +08:00
    那是 JS 实现的吧
    xi_lin
        2
    xi_lin  
    OP
       2015-11-18 17:26:51 +08:00
    @Sunnyyoung 只能通过 js 做么?
    kkhaike
        3
    kkhaike  
       2015-11-18 17:40:07 +08:00
    是的
    11
        4
    11  
       2015-11-18 17:41:01 +08:00
    keyword: lazyload js
    Sunnyyoung
        5
    Sunnyyoung  
       2015-11-18 19:19:14 +08:00
    @xi_lin 按照你现在的设计,使用的是 WebView ,只能通过 JS 了
    xi_lin
        6
    xi_lin  
    OP
       2015-11-18 19:26:32 +08:00
    了解了。谢谢大家! http://kittenyang.com/webview-javascript-bridge/ 这文章给了个 webview 下载的思路,不过要确定当前图片被显示出来看来还是只能靠 js 来获取了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1027 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:27 · PVG 06:27 · LAX 15:27 · JFK 18:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.