Iphone ios-未显示tableview附件指示灯
在我的tableview中,我为我的单元格使用背景图像(全黑色图像),我还希望在单元格中使用辅助指示器。在单元格的属性窗口中,我设置了AccessoryDisclosureIndicator 在我的.m文件中,我为tableview输入了以下代码:Iphone ios-未显示tableview附件指示灯,iphone,ios,ios5,uitableview,Iphone,Ios,Ios5,Uitableview,在我的tableview中,我为我的单元格使用背景图像(全黑色图像),我还希望在单元格中使用辅助指示器。在单元格的属性窗口中,我设置了AccessoryDisclosureIndicator 在我的.m文件中,我为tableview输入了以下代码: - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath{
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellAccessoryDisclosureIndicator;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
cell.backgroundColor = [UIColor clearColor];
}
cell.textLabel.backgroundColor=[UIColor clearColor];
cell.textLabel.text=[arrMagaza objectAtIndex:indexPath.row];
cell.textLabel.textColor=[UIColor whiteColor];
NSString *distance=[arrDistance objectAtIndex:indexPath.row];
cell.detailTextLabel.backgroundColor=[UIColor clearColor];
cell.detailTextLabel.textColor=[UIColor whiteColor];
cell.detailTextLabel.text=[distance stringByAppendingFormat:@" km"];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tablecell.png"]];
tableView.backgroundColor=[UIColor blackColor];
tableView.separatorColor= [UIColor clearColor];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
但当我运行应用程序时,视图上没有显示附件指示灯。
我做错了什么?我的细胞使用的背景图像有问题吗
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
此方法现在已被弃用,因此无需实现此方法。尝试删除所有其他内容。请发布添加图像的代码。如何设置单元格的背景图像?你的代码没问题,我想问题是你把图像画在了指示器上。删除backgorund映像只是为了测试。你不应该在单元格的背景上有清晰的颜色,这将以缓慢的滚动速度结束感谢您的建议我删除了该代码是的,我删除了该代码,现在它可以工作了,但我还有一个问题:UITableViewCellAccessoryDisclosureIndicator但为白色,是否可以更改其颜色以及如何更改?对于使用自定义图像,请为带有和UIImageView的单元格设置accessoryView并设置自定义图像(白色显示指示灯)显示到图像视图。