近来将第二不善的练习整理了一晃,并优化了瞬间懒加载图片

举行习题涉及与想到的触及

自身的练习代码
Github

  • Lazy load image in table view: Apple example
    LazyTableImagesor
    or
    SDWebImage
  • Try NSURLSession
  • 望文生义的力十分要紧
  • 拿到一个型代码,start step into from initial view,了解了全部 app
    的运转时之构造还是循环,才能够明了整个 app 的逻辑框架。
  • 框架>目录>类>方法>属性/实例变量,这样子下来整个一个 App
    就飞起了,入口即是
    main.m,然后各种设置属性和作信息,基于事件驱动的即刻同一交汇理解运行时是于方便的微粒。
  • Lazy load iamge use AFNetworking

    [cell.appImage setImageWithURL:[NSURL URLWithString:[mediumImage valueForKeyPath:@"label"]] placeholderImage:[UIImage imageNamed:@"placeholder"]];

习题完成情况

第二题

完成 1.0:

  • 贯彻 table view 自带刷新
  • 补充加 Cellular 开关,并能检查网络连接方式,并提醒用户
  • NSURLSession 下载 JSON

2015-08-26

进行中 1.1:

  • Lazy load iamge use AFNetworking

2015-09-03 11:36:32

Further Reading

  • 深入了解
    RunLoop

    经 Runloop 讲解了 NSURLConnection 的干活过程
    iOS 中,关于网络要的接口自下至上有如下几层:

CFSocket
CFNetwork       ->ASIHttpRequest
NSURLConnection ->AFNetworking
NSURLSession    ->AFNetworking2, Alamofire
  • CFSocket 是极致底部的接口,只负责 socket 通信。

  • CFNetwork 是基于 CFSocket 等接口的上层封装,ASIHttpRequest
    工作于这无异于重叠。

  • NSURLConnection 是基于 CFNetwork
    的再度高层的包装,提供面向对象的接口,AFNetworking 工作于当下无异重叠。

  • NSURLSession 是 iOS7 中新增的接口,表面上是和 NSURLConnection
    并列的,但底层仍然以了 NSURLConnection 的片功能 (比如
    com.apple.NSURLConnectionLoader 线程),AFNetworking2 和 Alamofire
    工作让当下同一重叠。

  • Network Reachability
    Manager

    AFNetworkReachabilityManager monitors the reachability of domains,
    and addresses for both WWAN and WiFi network interfaces.

    Do not use Reachability to determine if the original request
    should be sent.
    You should try to send it.
    You can use Reachability to determine when a request should be
    automatically retried.
    Although it may still fail, a Reachability notification that the
    connectivity is available is a good time to retry something.
    Network reachability is a useful tool for determining why a
    request might have failed.
    After a network request has failed, telling the user they’re
    offline is better than giving them a more technical but accurate
    error, such as “request timed out.”

  • See also WWDC 2012 session 706, “Networking Best
    Practices.

  • SDWebImage

    AFNetworking takes advantage of Foundation URL Loading System
    caching using NSURLCache, as well as a configurable in-memory
    cache for UIImageView and UIButton, which uses NSCache by default.
    Caching behavior can be further specified in the caching policy of
    a corresponding NSURLRequest. Other SDWebImage features, like
    background decompression of image data is also provided by
    AFNetworking.

    If you’re already using AFNetworking and just want an easy async
    image loading category, the built-in UIKit extensions will
    probably fit your needs.

  • AFNetworking
    example

    iOS example 非常经典,包含了运用办法与一个 UITableView实用框架。

  • AFNetworking 2.0
    Tutorial

测试题原文

1. 举行一个近似微信的拉扯的 tableview(tablewviewcell 自定义) 。只待 显示文字内容和用户头像(不需开输入有,文字内容好套)

1 必须实现仿内容背景
2 背景的尺寸和可观要相宜
3 发生者和接受者左右布局区分

2. 使 http api 请求解析 json or xml 数据,并且应用 tableview 展示出 http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/limit=10/json or xml

提示:

  1. 可应用第三方库,也足以利用 SDK 基础库
  2. 显网络下载数据时
  3. 比较 xml or json 解析效率
  4. tableviewcell自定义

注:

  • 企大家在一如既往健全内及传答案交最客班 github 个人的课业文件夹(以生编
    号命名)
  • IOS 专业 Github 目录:
    https://github.com/GeekBand/GeekBand-IOS-1501-Homework
  • 导师会在直播环节点评此题
  • 作业的终极批改和大成公布会在结业时开展。

相关文章

网站地图xml地图