1

i have a Grouped Cells Static TableView and i'd like to know how to archieve this design? The border and the shadow.

tableview

Thanks

Guilherme Miranda
  • 1,052
  • 2
  • 10
  • 19

3 Answers3

2

Without custom drawRect code you can't change the background of a cell.

There's a GitHub project based on the answer provided at this question.

Basically you have to draw three different types of custom cells based on the position of the cell (top, middle, bottom). I keep hoping each release of iOS will allow you to do this in a more direct manner.

Community
  • 1
  • 1
Richard Brown
  • 11,346
  • 4
  • 32
  • 43
2

You can change cell's backroundView value:

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];

Also you can change selectedBackgroundView value.

Artem Shmatkov
  • 1,434
  • 5
  • 22
  • 41
1

You must UITableViewCell override drawRect.

but, here is good Library. PrettyKit.

Using a this you'll be able to easily reach.

bitmapdata.com
  • 9,572
  • 5
  • 35
  • 43