How to change the alpha of the accessories view in UITableView?

advertisements

I am setting a image for accessory view in UITableView.I am trying to reduce the alpha of this view.This is what I have tried, which doesn't work.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

      UIImageView *accessoryImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menu.png"]];
      accessoryImageView.alpha = 0.7;
      cell.accessoryView = accessoryImageView;
      return cell;

}

Also tried this, with no success :

 - (UITableViewCell *)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

      UIImageView *accessoryImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menu.png"]];
      accessoryImageView.alpha = 0.7;
      cell.accessoryView = accessoryImageView;
      return cell;

 }


SubClass of UITableViewCell, and try this:

- (void)layoutSubviews{
    [super layoutSubviews];
    self.accessoryView.alpha = 0.7f;
}