UITableViewCell backgroundView does not extend beneath the separator view
| Originator: | luke | ||
| Number: | rdar://15131044 | Date Originated: | 02 Oct 2013 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.0 |
| Classification: | Serious bug | Reproducible: | Always |
Summary: When you set a custom background view for a UITableViewCell, it is resized by 1t shorter than the overall cell height to accommodate the 1pt table view separator that sits at the bottom of the cell, rather than to the full height of the cell (and thus extending beneath the separator). This causes two problems: * When the table view cell separator insets are non-zero (i.e. the default), the default background color of the table view cell (white on iOS7) shows through in the gap between the separator and the edge of the cell. * When a cell is selected, it's separator and the separator of the cell above it are hidden, resulting in the cell background showing completely in the cell above in the gap where the hidden separator would have been. * There is no gap on the selected cell, because unlike the backgroundView, the selectedBackgroundView extends to the full height of the cell and fills it completely. The only workaround is to set the backgroundColor of the table view cell to either clear or some other appropriate colour to match the cell's backgroundView. Because this can only be done in the 'willDisplayCell:*' delegate method, this has to be done everywhere and is very inconvenient. Steps to Reproduce: This can be reproduced using the stock Master Detail Xcode template with almost no customisation. You just need to set the backgroundView and selectedBackgroundView of the cell after it is dequeued to observe the effect. Expected Results: The frame of the cell's backgroundView should match the frame of the cell, such that the background fills the cell completely. When the cell separator is visible, it sits on top of the background view; when it is hidden, the background view shows through with no gaps. Actual Results: As described above, the resulting gaps in the cell allow the cell's background color to show through. Version: iOS 7.0/Xcode 5 GM.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!