0

I am trying to change the default button of a detailDisclosureButton of a UITableViewCell.

I am able to change the button by doing the following:

button.frame = CGRect(x: 0, y: 0, width: 10, height: 10)
button.backgroundColor = UIColor.black
cell.accessoryView = button

However, in this case I lose the carat for the disclosure indication to the right of the detail button. That is because defining an accessoryView ignores the value of the accessoryType according to the documentation.

Is there anyway to have the accessoryType be a detailDisclosureButton and to define a custom image for the button. i.e. custom button and keep the carat for disclosure?

alionthego
  • 8,508
  • 9
  • 52
  • 125

1 Answers1

0

Maybe this is what you want: link to apple docs

It is old but it shows you an example of just having the accessory or accessory with something custom.

This makes use of subclassing UIControl and overriding the drawRect within the subclass

Credit goes to this answer here: https://stackoverflow.com/a/27938584/1619193

The question is not exactly a duplicate and I did not want to post a link only solution

Hope this was what you were looking for

Community
  • 1
  • 1
Shawn Frank
  • 4,381
  • 2
  • 19
  • 29