-Homepage 16-frame for graph computation ---- use of MJExtention, mjextention

Source: Internet
Author: User

-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

 

Related Article

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.