0

I have a table view with multiple sections and don't know how to change the background color when i touch that row.

I've found this link about table cells but it is addressed to tables with only one section :

changing cell background on click on cell in iphone.

cell.selectedBackgroundView = [[ UIView alloc] init];
[cell.selectedBackgroundView setBackgroundColor:[UIColor purpleColor]];

if i use the code from this link, cells that are rounded (the first and last in every section) will have a rectangle on finger over which doesn't look good.

How can i make this rectangle curved around the edges for the first and last row in every section ?

Community
  • 1
  • 1
Alex
  • 10,869
  • 28
  • 93
  • 165

1 Answers1

1

How about using some quartz core. you can make any view round rect using view.layer.cornerRadius = 5.0;

make sure to import header

#import <QuartzCore/QuartzCore.h>

EDIT

Try to create custom cell then and set a UIView for background view property and change color as you wish. That way it will work.

UPDATE

Yes you are right. There is tutorial on internet for grouped tableView's let me google it for you. Use this post it has everything you need http://pessoal.org/blog/2009/02/25/customizing-the-background-border-colors-of-a-uitableview/

here is another stackoverflow post for the same

How to customize the background/border colors of a grouped table view cell?

Community
  • 1
  • 1
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256