// MyweiboTableViewCell.h
// 新浪微博
//
// Created by Jose on 15-4-21.
// Copyright (c) 2015年 jose. All rights reserved.
//
#import <UIKit/UIKit.h>
@class MyweiboFrame;
@interface MyweiboTableViewCell : UITableViewCell
/** 微博frame */
@property(nonatomic,strong)MyweiboFrame *weiboframe;
/** 初始化微博cell */
+(instancetype)CellWithTabelView:(UITableView *)tableview;
@end
*********************************************************************************************************************
*********************************************************************************************************************
*********************************************************************************************************************
//
// MyweiboTableViewCell.m
// 新浪微博
//
// Created by Jose on 15-4-21.
// Copyright (c) 2015年 jose. All rights reserved.
//
#import "MyweiboTableViewCell.h"
#import "MyweiboDetailView.h"
#import "MyweiboToolBarView.h"
#import "MyweiboFrame.h"
@interface MyweiboTableViewCell()
/** 原创和转发微博的view */
@property(nonatomic,weak)MyweiboDetailView *detailview;
/** 微博工具栏的view */
@property(nonatomic,weak)MyweiboToolBarView *toolbarview;
@end
@implementation MyweiboTableViewCell
//初始化cell
+(instancetype)CellWithTabelView:(UITableView *)tableview{
static NSString *ID=@"weibocell";
MyweiboTableViewCell *cell=[tableview dequeueReusableCellWithIdentifier:ID];
if (!cell) {
cell=[[MyweiboTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
}
//清空cell的背景色
cell.backgroundColor=[UIColor clearColor];
return cell;
}
//初始化cell的子控件
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
//1.添加原创和转发微博的view
MyweiboDetailView *detailview=[[MyweiboDetailView alloc]init];
[self.contentView addSubview:detailview];
_detailview=detailview;
//2.添加微博工具栏的view
MyweiboToolBarView *toolbarview=[[MyweiboToolBarView alloc]init];
[self.contentView addSubview:toolbarview];
_toolbarview=toolbarview;
}
return self;
}
//传入微博frame
-(void)setWeiboframe:(MyweiboFrame *)weiboframe{
_weiboframe=weiboframe;
//原创和转发微博的frame
_detailview.detailframe=weiboframe.detailframe;
//微博工具栏的frame
_toolbarview.frame=weiboframe.MyweiboToolBarFrame;
//传入微博数据
_toolbarview.weibo=weiboframe.weibo;
}
@end