stausFramesWithStatuses:newStatuses];
// 将最新的微博数据,添加到总数组的最前面
NSRange range = NSMakeRange(0, newFrames.count);
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:range];
[self.statusFrames insertObjects:newFrames atIndexes:set]; // statusFrames 这个是 数组,存放每一条微博的 frame模型
// 刷新表格
[self.tableView reloadData];
// 结束刷新
[control endRefreshing];
// 显示最新微博的数量
[self showNewStatusCount:newStatuses.count];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
HWLog(@"请求失败-%@", error);
// 结束刷新刷新
[control endRefreshing];
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// 获得cell
HWStatusCell *cell = [HWStatusCell cellWithTableView:tableView];
// 给cell传递模型数据, 在 setStatusFrame 里面完成 对各个子控件的 frame 赋值和 数据赋值。
cell.statusFrame = self.statusFrames[indexPath.row];
return cell;
}
---------------------------HWStatus.h---------------------------------------------
// HWStatus.h
//
// Created by apple on 14-10-12.
// Copyright (c) 2014年 heima. All rights reserved.
// 微博模型
#import <Foundation/Foundation.h>
@class HWUser;
@interface HWStatus : NSObject
/** string 字符串型的微博ID*/
@property (nonatomic, copy) NSString *idstr;
/** string 微博信息内容*/
@property (nonatomic, copy) NSString *text;
/** object 微博作者的用户信息字段 详细*/
@property (nonatomic, strong) HWUser *user;
/** string 微博创建时间*/
@property (nonatomic, copy) NSString *created_at;
/** string 微博来源*/
@property (nonatomic, copy) NSString *source;
@end
---------------------------HWStatus.m---------------------------------------------
// HWStatus.m
//
// Created by apple on 14-10-12.
// Copyright (c) 2014年 heima. All rights reserved.
//
#import "HWStatus.h"
@implementation HWStatus
@end
---------------------------HWStatusFrame.h---------------------------------------------
//
// HWStatusFrame.h
//
// Created by apple on 14-10-14.
// Copyright (c) 2014年 heima. All rights reserved.
// 一个HWStatusFrame模型里面包含的信息
// 1.存放着一个cell内部所有子控件的frame数据
//