2012-06-02 48 views
0

在我的tableview中,我使用背景图像作为我的细胞(完全黑色的图像),我也想在我的细胞中使用附件指示器。在细胞的属性窗口,我设置AccessoryDisclosureIndicatorios - tableview附件指示器未显示

在我的.m文件,我把这些代码的实现代码如下:

- (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; 
} 

但是当我运行应用程序的辅助指标不是在视图中显示。 我做错了什么?是关于我用于细胞的背景图像的问题吗?

+0

请发布添加图片的代码 –

+0

如何设置单元格的背景图片?你的代码是好的我认为这个问题是你通过指标绘制图像。删除backgorund图片只是为了测试。并且你不应该在单元格的backgorund颜色上有清晰的颜色,这将以低速滚动速度结束 –

+0

感谢您的建议我删除该代码 – ercan

回答

0
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath 

此方法现在不推荐使用,所以不需要实现此方法。尝试删除一切看起来不错。

+0

是的,我删除了代码,现在它的工作原理,但我有一个问题:UITableViewCellAccessoryDisclosureIndicator,但在白色是否可以改变它的颜色以及如何? – ercan

+0

对于使用自定义图像设置accessoryView与单元格和UIImageView并将自定义图像(白色DisclosureIndicator)设置为图像视图。 –