- (UITableViewCell *)tableView:(UITableView *)mtableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSInteger row = [indexPath row];
static NSString *CellIdentifier = @"cai-sflist-cell";
UITableViewCell *cell = (UITableViewCell*)[mtableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
NSDictionary *caiDictionary = [list objectAtIndex:row];
UIView *v = [[UIView alloc] initWithFrame:cell.frame];
if(row % 2 ){
v.backgroundColor = [UIColor whiteColor];
}else{
UIColor *backgroundColor = [UIColor colorWithRed:(251.0/255.0) green:(248.0/255) blue:(243.0/255) alpha:1.0];
v.backgroundColor = backgroundColor;
}
cell.backgroundView = v;
[v release];
cell.textLabel.text = [caiDictionary objectForKey:@"english"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor clearColor];
}
分享到:
相关推荐
UITableViewCell自定义等高
手写代码自定义UITableViewCell和xib自定义UITableViewCell的DEMO,适合初学者学习。
利用原始UITableViewcell强大的自适应性能,改造UITableViewcell,与自定义UITableViewcell略有不同
UITableViewCell动画效果
我们通过代码来探索UITableViewCell重用的实现
UITableViewCell 自动调节高度
优化UITableViewCell滚动性能,使用到Loren Brichter在Twitter中写到得关于UITableViewCell流畅滚动的内容。
NULL 博文链接:https://justsee.iteye.com/blog/2208725
UITableviewCell高度自适应
Xib设计UITableViewCell然后动态加载例子,对应博客贴子地址: http://blog.csdn.net/duanyipeng/article/details/7259108
自定义UITableViewCell。实现各种样式的表格输入界面ios源代码设计资料
IOS特定条件上UITABLEVIEWCELL不刷新的现象
UITableViewCell的四种不同的定制单元格方式
前两年IOS应用源码-主要是用于毕业设计学习的。
自定义UITableViewCell
ios7自定义UITableViewCell
uitabeview带图片的cell,UIimageview可以点击切换图片,cell也可以点击
UITableViewCell高度的自适应
上篇文章介绍了如何用UITableView显示表格,并讲了几种UITableViewCell的风格。不过有时候我们需要自己定义UITableViewCell的风格,其实就是向行中添加子视图。添加子视图的方法主要有两种:使用代码以及从.xib文件...
最下端再画个间隔。 可以看下这篇文章http://blog.csdn.net/fengshi_sh/article/details/39696159">由于一个项目中有大量的UITableViewCell需要书写,样式差不多都是 文字介绍:显示内容 这样的。自己又懒得写...