The basic separators look very simple and one dimension, but most of the table views out there have a good looking separators, I thing it looks good because it has shadow or something that makes it look 3D. How do they to that?
Asked
Active
Viewed 2,494 times
2
-
4http://stackoverflow.com/questions/1374990/how-to-customize-tableview-seperator-in-iphone http://stackoverflow.com/questions/2227420/iphone-uitableview-place-an-image-for-separator http://stackoverflow.com/questions/4804632/uitableview-separator-line – Rok Jarc Apr 18 '12 at 09:58
1 Answers
2
you could create your table either programmatically/XIB. Now either in Your code or XIB set:
yourTable.separatorStyle=UITableViewCellSeparatorStyleNone;
now in tableview delegate method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:businessLogicIdentifier]
autorelease];
customSeperator=[[UIView alloc]initWithFrame:CGRectMake(0, (cell.frame.origin.y), 320, 1)];
customSeperator.backgroundColor=[UIColor lightGrayColor];
[cell.contentView addSubview:customSeperator];
}
now at line (customSeperator.backgroundColor=[UIColor lightGrayColor];) you could also try
[UIColor colorWithPatternImage:[UIImage imageNamed:@"myimage.png"]];
for using Your Own Image. Hope it help you

maddy
- 4,001
- 8
- 42
- 65
-
thanks, eventually I created a background image for my cell that includes the separator, I think that is the best solution for me :) – Eyal Apr 26 '12 at 08:38