后来不在这么弄了,在定制cell的时候就配置,倒也管用 :
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.backgroundColor = [UIColorclearColor];
self.contentView.backgroundColor = [UIColorclearColor];
self.selectedBackgroundView = [[[UIViewalloc] initWithFrame:self.bounds]autorelease];
self.selectedBackgroundView.backgroundColor = [UIColorcolorWithRed:237.0f/255.0fgreen:237.0f/255.0fblue:237.0f/255.0falpha:1];
self.accessoryType =UITableViewCellAccessoryNone;
。。。}
chenyong: 在IOS7上有效果,但在IOS6上测试的时候如果只设置 cell.selectedBackgroundView.backgroundColor 那么还是没有效果,加上下边红线的后确实管用了
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier =@"appInformationCell";
AppTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[AppTableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier]autorelease];
UIView *view = [[UIViewalloc]init]; //必须得有一个 selectedBackgroundView不然下边的设置在IOS6上没用
cell.selectedBackgroundView = view;
[view release];
cell.selectedBackgroundView.backgroundColor = [UIColorcolorWithRed:237.0f/255.0fgreen:237.0f/255.0fblue:237.0f/255.0falpha:1];
}
NSMutableDictionary *dict = [self.applistArrayobjectAtIndex:indexPath.row];
[cell refreshWithData:dict];
return cell;
}
579

被折叠的 条评论
为什么被折叠?



