DJStatus.h
#import@class DJUser;/** 微博 */@interface DJStatus : NSObject/** 微博id */@property (nonatomic,copy) NSString *idstr;/** 微博内容 */@property (nonatomic,copy) NSString *text;/** 微博关联用户 */@property (nonatomic,strong) DJUser *user;/** 发布日期 */@property (nonatomic,copy) NSString *created_at;/** 来源 */@property (nonatomic,copy) NSString *source;/** 配图 */@property (nonatomic,strong) NSArray *pic_urls;@end
DJStatus.m
#import "DJStatus.h"#import "MJExtension.h"#import "DJPhoto.h"@implementation DJStatus+ (NSDictionary *)mj_objectClassInArray { return @{ @"pic_urls":[DJPhoto class]};}@end
DJPhoto.h
#import@interface DJPhoto : NSObject/** 图片缩略图 */@property (nonatomic,copy) NSString *thumbnail_pic;@end
DJStatusCellFrame.m
// 配图 CGFloat originalH; if (self.status.pic_urls.count) { // 有配图 CGFloat photoX = contentX; CGFloat photoY = CGRectGetMaxY(self.contentLabelF) + DJStatusCellMargin; CGFloat photoWH = 100; self.photoViewF = CGRectMake(photoX, photoY, photoWH, photoWH); originalH = CGRectGetMaxY(self.photoViewF) + DJStatusCellMargin; } else { // 无配图 originalH = CGRectGetMaxY(self.contentLabelF) + DJStatusCellMargin; }
最终效果: