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
太棒了!它現在工作:) – jcalonso 2011-05-20 16:53:32