Three methods of dictionary to model three: Mjextension Automatic dictionary model Mutual Transfer

Source: Internet
Author: User

1 #import "YSHomeViewController.h"2 #import "Uiimage+ys.h"3 #import "Uibarbuttonitem+ys.h"4 #import "YStitleButton.h"5 #import "AFNetworking.h"6 #import "YSaccountTool.h"7 #import "YSaccount.h"8 #import "uiimageview+webcache.h"9 #import "YSStatus.h"Ten #import "YSUser.h" One #import "MJExtension.h" A @interfaceYshomeviewcontroller () -@property (nonatomic,strong) Nsarray *statuses; - @end the @implementationYshomeviewcontroller -  --(void) Viewdidload - { + [Super Viewdidload]; - [self setupnavbar]; + [self setupweibolist]; A      at } --(void) Setupweibolist - { -Afhttprequestoperationmanager *mgr =[Afhttprequestoperationmanager manager]; -Nsmutabledictionary *param =[Nsmutabledictionary dictionary]; -Ysaccount *account =[Ysaccounttool account]; in      -param[@"Access_token"] =Account.access_token; to //param[@ "Count"] = @99; +[Mgr GET:@"Https://api.weibo.com/2/statuses/home_timeline.json"Parameters:param success:^ (Afhttprequestoperation *operation,IDresponseobject) { -Nsarray *dictarray = responseobject[@"statuses"]; the          *         //Advanced Technology-Runtime. Dictionary to Model $Self.statuses =[Ysstatus Mj_objectarraywithkeyvaluesarray:dictarray];Panax Notoginseng [Self.tableview Reloaddata]; -} failure:^ (Afhttprequestoperation *operation, Nserror *error) { the         +     }]; A}
1 ////2 ////YSStatus.h3 ////Ysweibo4 ////5 ////Created by Ys on 15/12/3.6 ////Copyright (c) 2015 Ys. All rights reserved.7 ////8 //9 //#import <Foundation/Foundation.h>Ten //@class Ysuser; One //@interface Ysstatus:nsobject A ///** - //* Content of Weibo (text) - // */ the //@property (nonatomic, copy) NSString *text; - ///** - //* The source of Weibo - // */ + //@property (nonatomic, copy) NSString *source; - ///** + //* Weibo ID A // */ at //@property (nonatomic, copy) NSString *idstr; - ///** - //* The number of tweets forwarded - // */ - //@property (nonatomic, assign) int reposts_count; - ///** in //* Number of comments on Weibo - // */ to //@property (nonatomic, assign) int comments_count; + ///** - //* Author of Weibo the // */ * //@property (nonatomic, strong) Ysuser *user; $ //@endPanax Notoginseng #import "YSStatus.h" - @implementationYsstatus the  + @end
1 ////2 ////YSUser.h3 ////Ysweibo4 ////5 ////Created by Ys on 15/12/3.6 ////Copyright (c) 2015 Ys. All rights reserved.7 ////8 //9 //#import <Foundation/Foundation.h>Ten // One //@interface Ysuser:nsobject A ///** - //* User's ID - // */ the //@property (nonatomic, copy) NSString *idstr; - ///** - //* User's nickname - // */ + //@property (nonatomic, copy) NSString *name; - ///** + //* User's Avatar A // */ at //@property (nonatomic, copy) NSString *profile_image_url; - //@end -  - #import "YSUser.h" -  - @implementationYsuser in  - @end

Three methods of dictionary to model three: Mjextension Automatic dictionary model Mutual Transfer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.