How can I customize the accessory disclosure image in a UITableViewCell?

前端 未结 9 584
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 15:55

I would like to use a custom version of the standard disclosure accessory image in my UITableView. How can I do this? I\'m hoping that sub-classing UITableViewCell is not ne

相关标签:
9条回答
  • 2020-12-07 16:23

    There is a nice example from Apple showing how to use UIControl to fulfill this kind of accessoryView customisation.

    Overriding - (void)drawRect:(CGRect)rect in UIControl is not the easiest way, but gives you lots of flexibility to style nice accessory views.

    enter image description here

    0 讨论(0)
  • 2020-12-07 16:25
    - (UITableViewCell *)tableView:(UITableView *)tView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        UIImage *indicatorImage = [UIImage imageNamed:@"Arrow.png"];
        cell.accessoryView =[[[UIImageView alloc]  initWithImage:indicatorImage] autorelease];
    
    
        return cell;
    }
    

    well i do this with the help code given above

    0 讨论(0)
  • 2020-12-07 16:30

    You'll need to create a custom view and assign it to the accessoryView property of the UITableViewCell object. Something like:

    myCell.accessoryView = [[ UIImageView alloc ] 
                           initWithImage:[UIImage imageNamed:@"Something" ]];
    
    0 讨论(0)
提交回复
热议问题