IOS7 cell.selectionStyle = UITableViewCellSelectionStyleBlue 不起作用怎么办,选中后背景是浅灰色的。

来源:互联网 发布:马塔潘角海战知乎 编辑:程序博客网 时间:2024/04/29 17:53
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (cell==nil) {

            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];

        }

    UIView *bgColorView = [[UIView alloc] init];

    bgColorView.backgroundColor = [UIColor blueColor];
    bgColorView.layer.masksToBounds = YES;
    cell.selectedBackgroundView = bgColorView;
    return cell;
}
0 0
原创粉丝点击