I’m currently writing an App which uses different selection Colors in a grouped Table View. This works great as far as it comes to Borders.
I’m able to change Selection Color with the Code in this Post:
How to customize the background/border colors of a grouped table view cell?
BUT I’d like to additionally have the nice Border around the Cells that Apple uses. How can I use this Border?
http://www.mediafire.com/?x2gxbkjqu4d2zto
This is the Code to create the Background – mostly copied from above Post:
http://www.mediafire.com/?kltwlni1mf4t7ks
And this is how I use it:
NSIndexPath * indexPath = [[[NSIndexPath alloc] initWithIndex:0] indexPathByAddingIndex:1];
CGRect frame = [[self tableView] rectForRowAtIndexPath:indexPath];
TLCustomCellBackgroundView * selectedBackgroundView = [[TLCustomCellBackgroundView alloc] initWithFrame:frame andColor:[UIColor redColor]];
[selectedBackgroundView setPosition:CustomCellBackgroundViewPositionBottom];
[[[self tableView] cellForRowAtIndexPath:indexPath] setSelectedBackgroundView:selectedBackgroundView];
As you can see I nearly got it working correctly except of the gray Border around the second Cell.
I found a Solution to this. it is not totally the same (as UITableviewCell in grouped Style got a even more sophisticated Design in iOS5 but this is sufficient to me. I borrowed this Approach from
http://cocoawithlove.com/2010/12/uitableview-construction-drawing-and.html
and it works great!
The code I used is: http://www.mediafire.com/?mdxkpfe8g74ctk9
Hope this helps others