标签:
---------- CZViewController.m ----------
#import "CZViewController.h"
#import "CZStatuse.h"
#import "CZStatuesCell.h"
#import "CZStatuesFrame.h"
@interface CZViewController ()<UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, strong) NSArray *statuseFrames;
@end
@implementation CZViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (BOOL)prefersStatusBarHidden
{
return YES;
}
- (NSArray *)statuseFrames
{
if (_statuseFrames == nil)
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"weibo.plist" ofType:nil];
NSArray *dictArray = [NSArray arrayWithContentsOfFile:path];
NSMutableArray *statuseFrameArray = [NSMutableArray array];
for (NSDictionary * dict in dictArray)
{
CZStatuse *statuse = [CZStatuse statuseWithDict:dict];
CZStatuesFrame *statuseFrame = [[CZStatuesFrame alloc]init];
statuseFrame.statuse = statuse;
[statuseFrameArray addObject:statuseFrame];
}
_statuseFrames = statuseFrameArray;
}
return _statuseFrames;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.statuseFrames.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CZStatuesCell * cell = [CZStatuesCell cellWithTableView:tableView];
cell.statuesFrame = self.statuseFrames[indexPath.row];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CZStatuesFrame *statuesFrame = self.statuseFrames[indexPath.row];
return statuesFrame.cellHeight;
}
@end
标签:
原文地址:http://www.cnblogs.com/lixiang2015/p/4719683.html