开发者

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

开发者 https://www.devze.com 2023-04-13 02:51 出处:网络
I use UITableView\'s cellForRowAtIndexPath to display the data (NSString*) by assigning cell.textLabel.text = [li开发者_运维知识库st objectAtIndex:indexPath.row];

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

精彩评论

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

关注公众号