设置分组静态TableView的样式

时间:2013-03-11 14:41:09

标签: objective-c uitableview tableview

我有一个Grouped Cells静态TableView,我想知道如何实现这个设计?边界和阴影。

tableview

由于

3 个答案:

答案 0 :(得分:2)

如果没有自定义drawRect代码,则无法更改单元格的背景。

根据GitHub project提供的答案,有一个this question

基本上,您必须根据单元格的位置(顶部,中间,底部)绘制三种不同类型的自定义单元格。我一直希望每个版本的iOS都能让你以更直接的方式做到这一点。

答案 1 :(得分:2)

您可以更改单元格的backroundView值:

UIImage *image = [[UIImage imageNamed:@"image-name"] stretchableImageWithLeftCapWidth:5.0 topCapHeight:5.0];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[imageView setImage:image];
self.backgroundView = imageView;
[imageView release];

您还可以更改selectedBackgroundView值。

答案 2 :(得分:1)

您必须UITableViewCell覆盖drawRect

但是,这是一个很好的图书馆。 PrettyKit

使用此功能,您将能够轻松到达。