开发者

is there a way to use the whole width of a cell in UITableView while keeping scrolling ability

I use UITableView's cellForRowAtIndexPath to display the data (NSString*) by assigning cell.textLabel.text = [li开发者_运维知识库st objectAtIndex:indexPath.row];

Everything is fine but I need to color certain lines, so I use cell.textLabel.backgroundColor and cell.textLabel.textColor. The colored lines look a bit ugly - they have blank space at the beginning and at the end (both are roughly 1 char wide). Maybe these are reserved for scrolling marker (up/down)? Is there a way to use the whole width of the cell while keeping scrolling ability up? Any special style or flag? Thanks. Victor


The label does not fill the entire cell, so setting its background colour will not cover everything.

Set the cell's background colour instead, but this has to be done in the willDisplayCell: delegate method, not cellForRowAtIndexPath: (see the docs for details: http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UITableViewCell_Class/Reference/Reference.html#//apple_ref/occ/cl/UITableViewCell

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜