tableviewcell重绘
2013-11-27 16:20
369 查看
NSString *CellIdentifier =[NSString stringWithFormat:@"Cell-%d-%d",indexPath.section,indexPath.row]; // [NSString stringWithFormat:@"cell%@", code];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.backgroundView = nil;
}
int sect = [indexPath section];
int row =[indexPath row];
NSDictionary *dic = [contentArray objectAtIndex:sect];
// NSLog(@"dic --- %d = %@",sect, [dic objectForKey:@"Code"]);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// NSLog(@"---section =%d----row=%d",sect,row);
switch (row) {
case 0:
{
UILabel *label1 =(UILabel *)[cell viewWithTag:sect*10+100];
if (label1 == nil) {
label1 = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, __MainScreen_Width/2, 44)];
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont systemFontOfSize:12.0f];
label1.tag =100 +sect*10;
label1.textAlignment = NSTextAlignmentLeft;
[cell addSubview:label1];
}
// NSLog(@"-----label1.tag =%d",label1.tag);
UILabel *label2 =(UILabel *)[cell viewWithTag:101 + sect*10];
if (label2 == nil) {
label2 = [[UILabel alloc] initWithFrame:CGRectMake(__MainScreen_Width/2, 0, __MainScreen_Width/2-15, 44)] ;
label2.backgroundColor = [UIColor clearColor];
label2.font = [UIFont systemFontOfSize:12.0f];
label2.tag =101 + sect *10;
label2.textAlignment = NSTextAlignmentRight;
[cell addSubview:label2];
}
// NSLog(@"-----label2.tag =%d",label2.tag);
label1.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Code"]];
label2.text = [dic objectForKey:@"Integral"];
}
break;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.backgroundView = nil;
}
int sect = [indexPath section];
int row =[indexPath row];
NSDictionary *dic = [contentArray objectAtIndex:sect];
// NSLog(@"dic --- %d = %@",sect, [dic objectForKey:@"Code"]);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// NSLog(@"---section =%d----row=%d",sect,row);
switch (row) {
case 0:
{
UILabel *label1 =(UILabel *)[cell viewWithTag:sect*10+100];
if (label1 == nil) {
label1 = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, __MainScreen_Width/2, 44)];
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont systemFontOfSize:12.0f];
label1.tag =100 +sect*10;
label1.textAlignment = NSTextAlignmentLeft;
[cell addSubview:label1];
}
// NSLog(@"-----label1.tag =%d",label1.tag);
UILabel *label2 =(UILabel *)[cell viewWithTag:101 + sect*10];
if (label2 == nil) {
label2 = [[UILabel alloc] initWithFrame:CGRectMake(__MainScreen_Width/2, 0, __MainScreen_Width/2-15, 44)] ;
label2.backgroundColor = [UIColor clearColor];
label2.font = [UIFont systemFontOfSize:12.0f];
label2.tag =101 + sect *10;
label2.textAlignment = NSTextAlignmentRight;
[cell addSubview:label2];
}
// NSLog(@"-----label2.tag =%d",label2.tag);
label1.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Code"]];
label2.text = [dic objectForKey:@"Integral"];
}
break;
相关文章推荐
- 鼠标触发移动的分层菜单 层菜单moveMenu
- JavaScript Select和Option列表元素上下左右移动
- C#中无边框窗体移动的简单实例
- c#文件的复制,移动,创建(实例代码)
- javascript:文字不间断向左移动的实例代码
- JS控制对象移动效果
- 移动指定文件夹内的全部文件
- [IT资讯]谷歌收购摩托罗拉移动
- 移动用户体验设计中的原型应用
- 自定义uitableviewcell
- AMD CEO罗瑞德称将调整战略 应对市场变化
- 常见电脑桌面图标问题十则
- 移动安全新时代 Chinasec起名赢iPad2
- 移动安全新时代 Chinasec起名赢iPad2
- 福建移动BOSS系统备份十年经验谈
- 容灾的核心在于保证业务连续性_山东省移动
- 安卓系统使用exchange2007邮件服务教程
- VTK类视频 切片移动直线获取灰度值
- 移动无标题(边框)窗体
- 移动老总上厕所!!!让你爽歪歪!!