[IOS]UITableView重用(使用多个自定义Cell)
#import "RemindInfoCell.h"
#import "ToDoCell.h"
#import "MessageCenterCell.h"
@interface RemindInbox ()<UITableViewDataSource,UITableViewDelegate>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier=@"cell";
UITableViewCell *theCell;
//文件审批提醒
if([[self.judgeStr isEqualToString:@"1"]){
RemindInfoCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell=[[RemindInfoCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
theCell = cell;
//赋值
[(RemindInfoCell *)theCell cValuationWithDate:@"05-07" andTime:@"13:23" andContent:@"文 收件箱——文 收件箱——文 收件箱——文 收件箱——文 收件箱——文 收件箱——文 收件箱——" andReadAlready:YES andHeight:60];
//重大事件提醒
}else if([[self.judgeStr isEqualToString:@"2"]){
RemindInfoCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell=[[RemindInfoCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
theCell = cell;
//赋值
[(RemindInfoCell *)theCell cValuationWithDate:@"10-21" andTime:@"20:32" andContent:@"重 收件箱——重 收件箱——重 收件箱——重 收件箱——重 收件箱——重 收件箱——重 收件箱——重 收件箱——重 收件箱——" andReadAlready:YES andHeight:60];
//代办事项
}else if([[self.judgeStr isEqualToString:@"3"]){
ToDoCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell=[[ToDoCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
theCell = cell;
//赋值
[(ToDoCell *)theCell cValuationWithDate:@"07-21" andTime:@"20:32" andTodoTime:@"2014年5月26日 11:02" andContent:@"待 收件箱——待 收件箱——待 收件箱——待 收件箱——待 收件箱——待 收件箱——待 收件箱——" andReadAlready:NO andHeight:70];
//消息中心
}else if([[self.judgeStr isEqualToString:@"4"]){
MessageCenterCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell=[[MessageCenterCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
}
theCell = cell;
//赋值
[(MessageCenterCell *)theCell cValuationWithDate:@"11-25" andTime:@"14:26" andLinkMan:@"王主任" andContent:@"消 收件箱——消 收件箱——消 收件箱——消 收件箱——消 收件箱——消 收件箱——消 收件箱——" andReadAlready:YES andUnreadNum:23 andHeight:60];
}
theCell.backgroundColor=[UIColor clearColor];
[theCell setClipsToBounds:YES];
return theCell;
}