|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
UITableView separators don't show after changing table background color
I have a UITableView, and when I set its background color to gray, the separator between the cells doesn't show. The separator color is set to white, and if I don't change the table's background color, the separators show up fine. Does anyone know why this is or how to fix it?
Thanks in advance... |
|
|
|
0
|
|
|
#2 |
|
If you're using code to set this all up, lets see it. If your are using the IB editor, then post the details via image captures.
__________________
My App: CameraTime - Time lapse photography for novice and advanced users.
|
|
|
|
0
|
|
|
#3 |
|
This code is in the UITableViewController
in viewDidLoad: Code:
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched;
self.tableView.separatorColor = [UIColor whiteColor];
self.tableView.backgroundColor = [UIColor colorWithRed:230.0 / 255.0 green:230.0 / 255.0 blue:230.0 / 255.0 alpha:1.0];
Code:
cell.contentView.backgroundColor = [UIColor colorWithRed:230.0 / 255.0 green:230.0 / 255.0 blue:230.0 / 255.0 alpha:1.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
|
|
|
|
0
|
|
|
#4 |
|
Have you tried setting the backgroundColor before setting the separatorColor?
__________________
|
|
|
|
0
|
|
|
#5 |
|
Yes, I did try that with no luck. The separators still didn't show.
|
|
|
|
0
|
|
|
#6 |
|
Alright, thought it was worth a shot. Thanks for trying.
__________________
|
|
|
|
0
|
|
|
#7 |
|
The issue seems to be that the backgroundColor property overrides the separatorColor property because regardless of what I set the separatorColor to, the separator lines end up being whatever color I set the backgroundColor to. I was setting the backgroundColor to the same color as my table cells so that the area under the last cell would be the same color, but this was making the separators the same color as the table cells, giving the appearance that they weren't there.
|
|
|
|
0
|
|
|
#8 |
|
UITableViewCellSeparatorStyleSingleLineEtched is "currently only supported for grouped-style table views". Try UITableViewCellSeparatorStyleSingleLine in it's place.
Also, given the code you mentioned, you should not need the two lines in the cellForRowAtIndexPath: method.
__________________
My App: CameraTime - Time lapse photography for novice and advanced users.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 02:56 AM.






I support the 
Linear Mode
