Small frameworks commonly used in ios
In ios development, it is very troublesome to request the kvc drop-down list image request and other handwritten code, and it is also prone to a series of problems. Now we have sorted out some commonly used small frameworks.
The MJExtension and MJRefresh frameworks are self-written by MJ,
1. AFNetworking-master is used for data requests
Usage:
// 1. create a request management object AFHTTPRequestOperationManager * mgr = [AFHTTPRequestOperationManager]; // 2. encapsulate the request parameter NSMutableDictionary * params = [NSMutableDictionary dictionary]; params [@ "access_token"] = [IWAccountTool account]. access_token; // 3. send request [mgr GET: @ "https://api.weibo.com/2/statuses/home_timeline.json" parameters: params success: ^ (AFHTTPRequestOperation * operation, id responseObject) {} failure: ^ (AFHTTPRequestOperation * operation, NSError * error) {}];
2. MBProgressHUD is a process dialog
Usage
[MBProgressHUD showMessage: @ "..."];
3. MJExtention is a tool of kvc. The dictionary-to-model feature of kvc is that when the dictionary-to-model conversion is performed, the model data must correspond to the dictionary one by one. Otherwise, problems may occur, in fact, sometimes some clients that pass values from the server do not need to use them, so some problems may occur,
MJExtention solves this problem. This framework traverses the attributes in the model data. If there is an attribute, it is assigned a value. If there is no attribute, it does not matter. The object is encapsulated in MJExtention, therefore, any object can be encapsulated.
Usage
// Convert the dictionary array into a model array (which contains the IWStatus model) NSArray * statusArray = [IWStatus objectArrayWithKeyValuesArray: responseObject [@ "statuses"];
4. The MJRefresh framework has not been used yet. It is to be updated.
5. The SDWebImage-master framework is dedicated to image processing.
We are prone to some problems when requesting images on the network, 1. When the main thread requests an image 2. When the image is returned, the item has changed. You can also say that the position has changed from 0 to the position where the display entry is + 1, or has been recycled, in this way, images may flash easily. 3. Because of the limited traffic on the mobile phone end, we need to cache images and manage image spaces .....
SDWebImage-master all these problems have been fixed for us.
Usage
// 2. Avatar [self. iconView setImageWithURL: [NSURL URLWithString: @ "http://xxxxxxxxxxxxx.jpg"] placeholderImage: [UIImage imageWithName: @ "avatar_default_small"];
One sentence
Frame: http://download.csdn.net/detail/codywangziham01/7895209
If there is no score, you can add me qq. I will pass you: 476959930