-Homepage 16-frame for graph computation ---- use of MJExtention, mjextention
------- HWPhoto. h ---------------------------------------------
# Import <Foundation/Foundation. h>
@ Interface HWPhoto: NSObject
/** Thumbnail address (model attribute ). Thumbnail_pic is the key in the dictionary in the pic_urls array */
@ Property (nonatomic, copy) NSString * thumbnail_pic; // make sure that the dictionary attributes are the same as the model attributes. (The dictionary attribute is the dictionary key in the pic_urls array)
@ End
------- HWPhoto. m ---------------------------------------------
# Import "HWPhoto. h"
@ Implementation HWPhoto
@ End
------- HWStatus. h ---------------------------------------------
# Import <Foundation/Foundation. h>
@ Class HWUser;
@ Interface HWStatus: NSObject
/** String-type Weibo ID */
@ Property (nonatomic, copy) NSString * idstr;
/** String Weibo content */
@ Property (nonatomic, copy) NSString * text;
/** Details of the user information field of the object Weibo author */
@ Property (nonatomic, strong) HWUser * user;
/** String Weibo creation time */
@ Property (nonatomic, copy) NSString * created_at;
/** String Weibo source */
@ Property (nonatomic, copy) NSString * source;
/** Weibo image placement address. Multiple graph links are returned when multiple graphs are created. Returns "[]" */
@ Property (nonatomic, strong) NSArray * pic_urls;
/** The original Weibo information field to be forwarded. When the microblog is forwarded to Weibo */
@ Property (nonatomic, strong) HWStatus * retweeted_status; // This is not like pic_urls:
-(NSDictionary *) objectClassInArray
{// There Is A pic_urls array in the returned data, which stores multiple dictionaries. Each dictionary represents the url of an image. The downstream write method converts the pic_urls dictionary array into a model array. That is, each dictionary in the pic_urls array is converted into an HWPhoto model.
Return @ {@ "pic_urls": [HWPhoto class]};
}
Because when MJExtension is used for conversion, retweeted_status can be directly converted to the model, because we know that its type is HWStatus, but what is in the array is unknown, therefore, it must be specified like return @ {@ "pic_urls": [HWPhoto class.
@ End
------- HWStatus. m ---------------------------------------------
# Import "HWStatus. h"
# Import "MJExtension. h"
# Import "HWPhoto. h"
@ Implementation HWStatus
-(NSDictionary *) objectClassInArray
{
// There Is A pic_urls array in the returned data, which stores multiple dictionaries. Each dictionary represents the url of an image. The downstream write method converts the pic_urls dictionary array into a model array. That is, each dictionary in the pic_urls array is converted into an HWPhoto model.
Return @ {@ "pic_urls": [HWPhoto class]};
}
@ End
______________________________________________________________________________________________
1