When I select and hold one of my user cells for a table UITableViewin the usual style, it displays my custom selection color ( redColorin this case), but if I hold it down and scroll, the user selection color and user background disappear (showing UIImageViewbehind the table.
UITableViewis created in IB and has a background set to clearColorso that the image is displayed through.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:kCellIdentifier]
autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.backgroundView = [[[UIImageView alloc] init] autorelease];
cell.selectedBackgroundView = [[[UIImageView alloc] init] autorelease];
}
cell.backgroundView.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"customBackground"]];
cell.selectedBackgroundView.backgroundColor = [UIColor redColor];
return cell;
}
Can anyone help? Thank!
source
share