资料来源 : http://github.ibireme.com/github/list/ios

GitHub : 链接地址

简介 :

A delightful iOS and OS X networking framework.

推荐参考 :

http://afnetworking.com

http://www.aiuxian.com/article/p-1537192.html

链接地址一、 文件目录

链接地址1. AFNetworking 目录内容

链接地址2. UIKit+AFNetworking 目录内容

链接地址3. 关联关系(AFNetworking)

链接地址二、 详细介绍

链接地址1. AFNetworking

这是 AFNetworking 的主要部分,包括 6 个功能部分共 9 个类。

链接地址1)AFNetworking.h

  1. #import <Foundation/Foundation.h>
  2. #import <Availability.h>
  3. #ifndef _AFNETWORKING_
  4. #define _AFNETWORKING_
  5. #import "AFURLRequestSerialization.h"
  6. #import "AFURLResponseSerialization.h"
  7. #import "AFSecurityPolicy.h"
  8. #import "AFNetworkReachabilityManager.h"
  9. #import "AFURLConnectionOperation.h"
  10. #import "AFHTTPRequestOperation.h"
  11. #import "AFHTTPRequestOperationManager.h"
  12. #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \
  13. ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) )
  14. #import "AFURLSessionManager.h"
  15. #import "AFHTTPSessionManager.h"
  16. #endif
  17. #endif /* _AFNETWORKING_ */

这是 AFNetworking 的公共头文件,在使用 AFNetworking 库时可直接在 Prefix.pch 文件中引入,或者在工程的网络管理模块相关文件中引入。

链接地址2)AFSecurityPolicy.h

  1. /**
  2. `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections.
  3. Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.
  4. */
  5. @interface AFSecurityPolicy : NSObject
  6. /**
  7. The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`.
  8. */
  9. @property (nonatomic, assign) AFSSLPinningMode SSLPinningMode;
  10. /**
  11. Whether to evaluate an entire SSL certificate chain, or just the leaf certificate. Defaults to `YES`.
  12. */
  13. @property (nonatomic, assign) BOOL validatesCertificateChain;
  14. /**
  15. The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle.
  16. */
  17. @property (nonatomic, strong) NSArray *pinnedCertificates;
  18. /**
  19. Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`.
  20. */
  21. @property (nonatomic, assign) BOOL allowInvalidCertificates;
  22. /**
  23. Whether or not to validate the domain name in the certificates CN field. Defaults to `YES` for `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate`, otherwise `NO`.
  24. */
  25. @property (nonatomic, assign) BOOL validatesDomainName;

这个类主要是为网络请求添加 SSL 安全验证, SSL 安全验证类型有如下三种,默认是 AFSSLPinningModeNone 类型,另外通过 SSL 证书和密钥可以增加请求的安全性,避免请求被劫持和攻击。

  1. typedef NS_ENUM(NSUInteger, AFSSLPinningMode) {
  2. AFSSLPinningModeNone,
  3. AFSSLPinningModePublicKey,
  4. AFSSLPinningModeCertificate,
  5. };

关于 SSL 和数字证书相关可参考这里(SSL)这里(数字证书)。

链接地址3)AFNetworkReachabilityManager.h

  1. /**
  2. `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
  3. See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/)
  4. @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
  5. */
  6. @interface AFNetworkReachabilityManager : NSObject
  7. /**
  8. The current network reachability status.
  9. */
  10. @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;
  11. /**
  12. Whether or not the network is currently reachable.
  13. */
  14. @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;
  15. /**
  16. Whether or not the network is currently reachable via WWAN.
  17. */
  18. @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;
  19. /**
  20. Whether or not the network is currently reachable via WiFi.
  21. */
  22. @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;

这个类和苹果官方提供的 Reachability 类功能类似,但是功能更加强大,不仅增加了更多的公共属性,也增加了状态变更闭包(block)操作,还增加了通知标志串,用过 Reachability 应该能够很快理解并爱上这个类。

链接地址4)AFURLConnectionOperation.h

  1. @interface AFURLConnectionOperation : NSOperation <NSURLConnectionDelegate, NSURLConnectionDataDelegate, NSCoding, NSCopying>
  2. ///-------------------------------
  3. /// @name Accessing Run Loop Modes
  4. ///-------------------------------
  5. /**
  6. The run loop modes in which the operation will run on the network thread. By default, this is a single-member set containing `NSRunLoopCommonModes`.
  7. */
  8. @property (nonatomic, strong) NSSet *runLoopModes;
  9. ///-----------------------------------------
  10. /// @name Getting URL Connection Information
  11. ///-----------------------------------------
  12. /**
  13. The request used by the operation's connection.
  14. */
  15. @property (readonly, nonatomic, strong) NSURLRequest *request;
  16. /**
  17. The last response received by the operation's connection.
  18. */
  19. @property (readonly, nonatomic, strong) NSURLResponse *response;
  20. /**
  21. The error, if any, that occurred in the lifecycle of the request.
  22. */
  23. @property (readonly, nonatomic, strong) NSError *error;
  24. ///----------------------------
  25. /// @name Getting Response Data
  26. ///----------------------------
  27. /**
  28. The data received during the request.
  29. */
  30. @property (readonly, nonatomic, strong) NSData *responseData;
  31. /**
  32. The string representation of the response data.
  33. */
  34. @property (readonly, nonatomic, copy) NSString *responseString;
  35. /**
  36. The string encoding of the response.
  37. If the response does not specify a valid string encoding, `responseStringEncoding` will return `NSUTF8StringEncoding`.
  38. */
  39. @property (readonly, nonatomic, assign) NSStringEncoding responseStringEncoding;
  40. ///-------------------------------
  41. /// @name Managing URL Credentials
  42. ///-------------------------------
  43. /**
  44. Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default.
  45. This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`.
  46. */
  47. @property (nonatomic, assign) BOOL shouldUseCredentialStorage;
  48. /**
  49. The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`.
  50. This will be overridden by any shared credentials that exist for the username or password of the request URL, if present.
  51. */
  52. @property (nonatomic, strong) NSURLCredential *credential;
  53. ///-------------------------------
  54. /// @name Managing Security Policy
  55. ///-------------------------------
  56. /**
  57. The security policy used to evaluate server trust for secure connections.
  58. */
  59. @property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
  60. ///------------------------
  61. /// @name Accessing Streams
  62. ///------------------------
  63. /**
  64. The input stream used to read data to be sent during the request.
  65. This property acts as a proxy to the `HTTPBodyStream` property of `request`.
  66. */
  67. @property (nonatomic, strong) NSInputStream *inputStream;
  68. /**
  69. The output stream that is used to write data received until the request is finished.
  70. By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set.
  71. */
  72. @property (nonatomic, strong) NSOutputStream *outputStream;
  73. ///---------------------------------
  74. /// @name Managing Callback Queues
  75. ///---------------------------------
  76. /**
  77. The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
  78. */
  79. @property (nonatomic, strong) dispatch_queue_t completionQueue;
  80. /**
  81. The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
  82. */
  83. @property (nonatomic, strong) dispatch_group_t completionGroup;
  84. ///---------------------------------------------
  85. /// @name Managing Request Operation Information
  86. ///---------------------------------------------
  87. /**
  88. The user info dictionary for the receiver.
  89. */
  90. @property (nonatomic, strong) NSDictionary *userInfo;

这是一个 NSOperation 子类,它实现了 NSURLConnection 的全部代理方法,所执行的是单个网络请求的操作。

链接地址5)AFHTTPRequestOperation.h

  1. /**
  2. `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request.
  3. */
  4. @interface AFHTTPRequestOperation : AFURLConnectionOperation
  5. ///------------------------------------------------
  6. /// @name Getting HTTP URL Connection Information
  7. ///------------------------------------------------
  8. /**
  9. The last HTTP response received by the operation's connection.
  10. */
  11. @property (readonly, nonatomic, strong) NSHTTPURLResponse *response;
  12. /**
  13. Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an AFHTTPResponse serializer, which uses the raw data as its response object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed.
  14. @warning `responseSerializer` must not be `nil`. Setting a response serializer will clear out any cached value
  15. */
  16. @property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;
  17. /**
  18. An object constructed by the `responseSerializer` from the response and response data. Returns `nil` unless the operation `isFinished`, has a `response`, and has `responseData` with non-zero content length. If an error occurs during serialization, `nil` will be returned, and the `error` property will be populated with the serialization error.
  19. */
  20. @property (readonly, nonatomic, strong) id responseObject;

这是 AFURLConnectionOperation 的子类,主要针对 HTTP 和 HTTPS 类型的请求,这也是最常用的请求操作。

链接地址6)AFHTTPRequestOperationManager.h

  1. @interface AFHTTPRequestOperationManager : NSObject <NSCoding, NSCopying>
  2. /**
  3. The URL used to monitor reachability, and construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
  4. */
  5. @property (readonly, nonatomic, strong) NSURL *baseURL;
  6. /**
  7. Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
  8. @warning `requestSerializer` must not be `nil`.
  9. */
  10. @property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer;
  11. /**
  12. Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to a JSON serializer, which serializes data from responses with a `application/json` MIME type, and falls back to the raw data object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed.
  13. @warning `responseSerializer` must not be `nil`.
  14. */
  15. @property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;
  16. /**
  17. The operation queue on which request operations are scheduled and run.
  18. */
  19. @property (nonatomic, strong) NSOperationQueue *operationQueue;
  20. ///-------------------------------
  21. /// @name Managing URL Credentials
  22. ///-------------------------------
  23. /**
  24. Whether request operations should consult the credential storage for authenticating the connection. `YES` by default.
  25. @see AFURLConnectionOperation -shouldUseCredentialStorage
  26. */
  27. @property (nonatomic, assign) BOOL shouldUseCredentialStorage;
  28. /**
  29. The credential used by request operations for authentication challenges.
  30. @see AFURLConnectionOperation -credential
  31. */
  32. @property (nonatomic, strong) NSURLCredential *credential;
  33. ///-------------------------------
  34. /// @name Managing Security Policy
  35. ///-------------------------------
  36. /**
  37. The security policy used by created request operations to evaluate server trust for secure connections. `AFHTTPRequestOperationManager` uses the `defaultPolicy` unless otherwise specified.
  38. */
  39. @property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
  40. ///------------------------------------
  41. /// @name Managing Network Reachability
  42. ///------------------------------------
  43. /**
  44. The network reachability manager. `AFHTTPRequestOperationManager` uses the `sharedManager` by default.
  45. */
  46. @property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;

这是 AFHTTPRequestOperation 的一个管理类,细化了不同类型的请求操作( GET、HEAD、POST、PUT、PATCH、DELETE ),通过这个管理类创建的网络请求操作都会被加入到 operationQueue 中执行。

链接地址7)AFURLSessionManager.h

  1. @interface AFURLSessionManager : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate, NSCoding, NSCopying>
  2. /**
  3. The managed session.
  4. */
  5. @property (readonly, nonatomic, strong) NSURLSession *session;
  6. /**
  7. The operation queue on which delegate callbacks are run.
  8. */
  9. @property (readonly, nonatomic, strong) NSOperationQueue *operationQueue;
  10. /**
  11. Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
  12. @warning `responseSerializer` must not be `nil`.
  13. */
  14. @property (nonatomic, strong) id <AFURLResponseSerialization> responseSerializer;
  15. ///-------------------------------
  16. /// @name Managing Security Policy
  17. ///-------------------------------
  18. /**
  19. The security policy used by created request operations to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified.
  20. */
  21. @property (nonatomic, strong) AFSecurityPolicy *securityPolicy;
  22. ///--------------------------------------
  23. /// @name Monitoring Network Reachability
  24. ///--------------------------------------
  25. /**
  26. The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default.
  27. */
  28. @property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager;
  29. ///----------------------------
  30. /// @name Getting Session Tasks
  31. ///----------------------------
  32. /**
  33. The data, upload, and download tasks currently run by the managed session.
  34. */
  35. @property (readonly, nonatomic, strong) NSArray *tasks;
  36. /**
  37. The data tasks currently run by the managed session.
  38. */
  39. @property (readonly, nonatomic, strong) NSArray *dataTasks;
  40. /**
  41. The upload tasks currently run by the managed session.
  42. */
  43. @property (readonly, nonatomic, strong) NSArray *uploadTasks;
  44. /**
  45. The download tasks currently run by the managed session.
  46. */
  47. @property (readonly, nonatomic, strong) NSArray *downloadTasks;
  48. ///---------------------------------
  49. /// @name Managing Callback Queues
  50. ///---------------------------------
  51. /**
  52. The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used.
  53. */
  54. @property (nonatomic, strong) dispatch_queue_t completionQueue;
  55. /**
  56. The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used.
  57. */
  58. @property (nonatomic, strong) dispatch_group_t completionGroup;

这是 AFNetworking 实现的 NSURLSession 的一个管理类,在这个类里面已经实现了全部相关的 NSURLSession 代理方法,NSURLSession 是 iOS7 新增加的用于网络请求相关的任务类,具体可参考 这里(苹果官方文档) 、 这里(相关博客一) 和 这里(相关博客二) 。

链接地址8)AFHTTPSessionManager.h

  1. @interface AFHTTPSessionManager : AFURLSessionManager <NSCoding, NSCopying>
  2. /**
  3. The URL used to monitor reachability, and construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods.
  4. */
  5. @property (readonly, nonatomic, strong) NSURL *baseURL;
  6. /**
  7. Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies.
  8. @warning `requestSerializer` must not be `nil`.
  9. */
  10. @property (nonatomic, strong) AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer;
  11. /**
  12. Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`.
  13. @warning `responseSerializer` must not be `nil`.
  14. */
  15. @property (nonatomic, strong) AFHTTPResponseSerializer <AFURLResponseSerialization> * responseSerializer;

这是 AFURLSessionManager 的一个管理类,针对 HTTP 细化了不同类型的请求操作( GET、HEAD、POST、PUT、PATCH、DELETE ),因为 NSURLSession 是 iOS7 新增加的用于网络请求相关的任务类,所以仅针对 iOS7 系统时可考虑优先使用这个管理类替代 AFHTTPRequestOperationManager ,如果需要考虑向前兼容,还是需要使用 AFHTTPRequestOperationManager 。

链接地址9)AFURLRequestSerialization.h

这个文件主要定义了一些用于网络请求的协议和类,其中包括了请求格式、请求参数以及相关请求设置的方法。

链接地址10)AFURLResponseSerialization.h

这个文件主要定义了一些网络返回数据格式以及解析的协议和类,包括JSON、XML、Image等格式的返回数据获取和格式解析等。

链接地址2. UIKit+AFNetworking

这是 AFNetworking 针对 UIKit 部分系统控件做的类别扩展,包括 1 个管理类定义和 8 个类别扩展。

链接地址1)UIKit+AFNetworking.h

  1. #import <UIKit/UIKit.h>
  2. #ifndef _UIKIT_AFNETWORKING_
  3. #define _UIKIT_AFNETWORKING_
  4. #import "AFNetworkActivityIndicatorManager.h"
  5. #import "UIActivityIndicatorView+AFNetworking.h"
  6. #import "UIAlertView+AFNetworking.h"
  7. #import "UIButton+AFNetworking.h"
  8. #import "UIImageView+AFNetworking.h"
  9. #import "UIKit+AFNetworking.h"
  10. #import "UIProgressView+AFNetworking.h"
  11. #import "UIWebView+AFNetworking.h"
  12. #endif /* _UIKIT_AFNETWORKING_ */

这是 UIKit+AFNetworking 的公共头文件,如果需要使用 AFNetworking 的 UIKit 扩展时可直接在 Prefix.pch 文件中引入,或者在工程的相关文件中引入。

链接地址2)AFNetworkActivityIndicatorManager.h

  1. @interface AFNetworkActivityIndicatorManager : NSObject
  2. /**
  3. A Boolean value indicating whether the manager is enabled.
  4. If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
  5. */
  6. @property (nonatomic, assign, getter = isEnabled) BOOL enabled;
  7. /**
  8. A Boolean value indicating whether the network activity indicator is currently displayed in the status bar.
  9. */
  10. @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible;

这个类主要是为了自动显示和隐藏请求时的状态提示,如果你确实需要它的话用这个类还是很方便的,使用方法也很简单。只要在  AppDelegate application:didFinishLaunchingWithOptions: 方法中添加一句

  1. [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];

就可以了,之后在使用 AFNetworking 发起请求和终止请求时都会自动显示和隐藏状态提示。

链接地址3)UIActivityIndicatorView+AFNetworking.h

  1. #import <Foundation/Foundation.h>
  2. #import <Availability.h>
  3. #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
  4. #import <UIKit/UIKit.h>
  5. @class AFURLConnectionOperation;
  6. /**
  7. This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task.
  8. */
  9. @interface UIActivityIndicatorView (AFNetworking)
  10. ///----------------------------------
  11. /// @name Animating for Session Tasks
  12. ///----------------------------------
  13. /**
  14. Binds the animating state to the state of the specified task.
  15. @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled.
  16. */
  17. #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
  18. - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task;
  19. #endif
  20. ///---------------------------------------
  21. /// @name Animating for Request Operations
  22. ///---------------------------------------
  23. /**
  24. Binds the animating state to the execution state of the specified operation.
  25. @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled.
  26. */
  27. - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation;
  28. @end

这个类别为网络请求的状态显示增加了两个方法,通过这两个方法可以根据当前任务的状态或操作的状态决定网络请求状态的显示与隐藏。

链接地址4)UIAlertView+AFNetworking.h

和上面的类别类似,不过这个类别主要是为 UIAlertView 增加了几个方法,当相关的网络任务和请求操作发生错误时,会弹出一个 UIAlertView ,虽然 iOS7 的 UIAlertView 看上去温柔很多,很我个人还是很讨厌这个粗暴的弹出提示,我同样不喜欢转圈圈的等待提示。

链接地址5)UIButton+AFNetworking.h

这个类别主要是为 UIButton 增加了异步获取网络图片的类别方法,用过类似 EGOImageView 的应该很容易理解。

链接地址6)UIImageView+AFNetworking.h

说曹操曹操到,这个就是 EGOImageView 的 AFNetworking 版。

链接地址7)UIProgressView+AFNetworking.h

同 UIActivityIndicatorView+AFNetworking ,只是这个类别是针对 UIProgressView 的。

链接地址8)UIRefreshControl+AFNetworking.h

同 UIActivityIndicatorView+AFNetworking ,只是这个类别是针对 UIRefreshControl 的。UIRefreshControl 是 iOS7 新增加的下拉刷新显示控件,通过这个类别可以根据网络的行为和请求结果决定 UIRefreshControl 的显示状态。

链接地址9)UIWebView+AFNetworking.h

为 UIWebView 的载入请求增加了几个类别方法,便于决定请求成功失败如何显示,以及请求过程中等待状态的显示等。

链接地址三、 一点总结

粗略的浏览完 AFNetworking 的源代码之后深刻的感受了一下那么一句话:“我们不生产代码,我们只是 Github 的搬运工!”。自省一下,继续努力!

http://www.aiuxian.com/article/p-1715579.html

转:AFNetworking 与 UIKit+AFNetworking 详解的更多相关文章

  1. AFNetworking 与 UIKit+AFNetworking 详解

    资料来源 : http://github.ibireme.com/github/list/ios GitHub : 链接地址 简介 : A delightful iOS and OS X networ ...

  2. AFNetworking 3.0 使用详解 和 源码解析实现原理

    AFN原理&& AFN如何使用RunLoop来实现的: 让你介绍一下AFN源码的理解,首先要说说封装里面主要做了那些重要的事情,有那些重要的类(XY题) 一.AFN的实现步骤: NSS ...

  3. iOS AFNetWorking源码详解(一)

    来源:Yuzeyang 链接:http://zeeyang.com/2016/02/21/AFNetWorking-one/ 首先来介绍下AFNetWorking,官方介绍如下: AFNetworki ...

  4. AFNetworking 用法详解

    之前一直使用ASIHttpRequest 做网络请求 ,后来新公司用AFNetWorking ,经过一段时间学习总结一下二者的优缺点: 1.AFNetWorking的优缺点 优点: 1.维护和使用者比 ...

  5. AFNetworking 内部详解

    AFNetworking 是一个适用于IOS 和 Mac OSX 两个平台的网络库,他是在Foundation URL Loading System  基础上进行的一套封装 ,并提供了丰富的API接口 ...

  6. AFNetworking详解和相关文章链接

    写在开头: 作为一个iOS开发,也许你不知道NSUrlRequest.不知道NSUrlConnection.也不知道NSURLSession...(说不下去了...怎么会什么都不知道...)但是你一定 ...

  7. iOS开发——网络编程Swift篇&Alamofire详解

    Alamofire详解 预览图 Swift Alamofire 简介 Alamofire是 Swift 语言的 HTTP 网络开发工具包,相当于Swift实现AFNetworking版本. 当然,AF ...

  8. CocoaPods详解之(二)----进阶篇

    CocoaPods详解之----进阶篇 作者:wangzz 原文地址:http://blog.csdn.net/wzzvictory/article/details/19178709 转载请注明出处 ...

  9. ios新特征 ARC详解

    IOS ARC 分类: IOS ARC2013-01-17 09:16 2069人阅读 评论(0) 收藏 举报   目录(?)[+]   关闭工程的ARC(Automatic Reference Co ...

随机推荐

  1. 通过VS2010命令提示窗口创建强命名文件时报错问题

    问题描述详见图 解决方案 00000005意思是Access Denied(即拒绝访问). 原因是:Program Files(x86)目录对一般用户和未提升权限的管理员是只读的. 所以只要赋予Use ...

  2. SQLite数据库操作 (原始操作)

    android提供了一个名为SQLiteDatabase的类,该类封装了一些操作数据库的API, 使用该类可以完成对数据进行添加(Create).查询(Retrieve).更新(Update)和删除( ...

  3. [转]Debugging the Mac OS X kernel with VMware and GDB

    Source: http://ho.ax/posts/2012/02/debugging-the-mac-os-x-kernel-with-vmware-and-gdb/ Source: http:/ ...

  4. 企业架构与建模之使用ArchiMate进行分析

    企业架构与建模之使用ArchiMate进行分析(全系列完) 4. 使用ArchiMate进行分析 正如前面所说的那样,一个企业整体效率的提升有时并不是通过某一个领域内的优化就能达到的,而且这种忽视全局 ...

  5. [转]http://www.russbishop.net/xcode-exception-breakpoints

    原文:http://www.russbishop.net/xcode-exception-breakpoints Many people are not aware of Xcode's powerf ...

  6. [转]在 Mac OS X上编译 libimobiledevice 的方法

    link: http://blog.boceto.fr/2012/05/05/libimobiledevice-for-macosx/ The objective of the day: Compil ...

  7. GEF-whole-upload教程中遇到的问题及解决方案

    最近在学习GEF开发,使用的是GEF-whole-upload这个教程.由于教程当时所使用的版本与本人使用的版本有一些差异,中间出现了不少问题,现在将解决方案分享给大家. 本人使用的Eclipse版本 ...

  8. mongodb学习(翻译1)

    学习mongodb,试着翻译写,英语能力有限,希望大家指正,不顺畅地方大家担待,会后续翻译后面内容: 开始认识C#驱动(官方) 简介 本介绍提供了足够的信息,让你开始使用C#的驱动程序.起步之后,你可 ...

  9. 人工智能搜索算法(深度优先、迭代加深、一致代价、A*搜索)

    搜索算法问题求解 一.需求分析 分别用深度优先.迭代加深.一致代价.A*搜索算法得到从起始点Arad到目标点Bucharest的一条路径,即为罗马尼亚问题的一个解,在求解的过程中记录每种算法得到的解, ...

  10. 绘制基本图形和线型(StrokeStyle)的设置详解

    绘制基本图形和线型(StrokeStyle)的设置详解 目前,在博客园上,相对写得比较好的两个关于Direct2D的教程系列,分别是万一的Direct2D系列和zdd的Direct2D系列.有兴趣的网 ...