Search code examples
iphoneuitableviewaccessoryview

Way to change icon of accessory type in UITableviewcell


I have table view which is showing list of files to download. When I tap the accessory button it will download the selected file. I want to change image of detail disclosure button. Is it possible....?

And If I use Button with image in accessory view. Is there any table delegate method for this...


Solution

  • Answer2: You can make your own method and call that in that case.

    int row=indexPath.row;
    
    UIButton *trackImageOnMap=[[UIButton alloc] initWithFrame:CGRectMake(420, 9, 40, 50)];
    [trackImageOnMap setImage:[UIImage imageNamed:@"track_map_icon.png"] forState:UIControlStateNormal];
    int iId=[[self.imageId objectAtIndex:row] intValue];
    NSLog(@"iId=%d",iId);
    [trackImageOnMap setTag:iId];
    [trackImageOnMap addTarget:self action:@selector(trackImageOnMapButtonTouched:)forControlEvents:UIControlEventTouchDown];
    [trackImageOnMap setContentMode:UIViewContentModeScaleToFill];
    //[cell setAccessoryView:trackImageOnMap];
    [cell addSubview:trackImageOnMap];