2011-05-20 47 views
0

我试图通过设置与UIImageView的backgroundView,但不能正常工作,因为你可以在图像中看到我的UITableView看起来如何。 (仅适用于accessoryType和文本前一行的开头)。UITableView backgroundview不工作在文本区域

有人可以帮助我吗?

我的代码:

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

} 

    // Configure the cell. 
    NSDictionary *lineaAutobus = [buscamionService objectAtIndex:indexPath.row]; 

    NSString *lineaAutobusNombre = [lineaAutobus objectForKey:@"nombre_lineaAutobus"]; 

    [cell setBackgroundView:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tableViewCellBg.png"]] autorelease]]; 
    cell.textLabel.text = lineaAutobusNombre; 


return cell; 
} 

https://www.dropbox.com/s/ubok76ipshei931/Screen%20shot%202011-05-20%20at%206.25.29%20PM.png

回答

1

也许你需要在为textLabel的backgroundColor设置为[的UIColor clearColor]?

+0

太棒了!它现在工作:) – jcalonso 2011-05-20 16:53:32