UILabel view iOS - how to add a disclosure icon

856 Views Asked by At

I have built a custom view and it includes a UILabel. My goal is to have a disclosure icon right beside the label. So it would look something like this in the end:

"Click here to go to credit card page >"

so i would like to add the iOS cell disclosure icon to the UILabel. How can this be done ? I tried accessing the UILabel accessoryView but it seems to not have one. Also how would i get the icon itself to make use of it ?

1

There are 1 best solutions below

0
Sam B On

There is no such thing as disclosure indicator for UILabel. Disclosure indicators are only for UITableView. There are two way to approach this problem

  1. Create a sample png image that looks like ">" indicator and add a UIImageView right after your UILabel.

  2. Create UITableView VC and make it static grouped cell. Then add "Click here to go to credit card page" to the cell detail text and add disclosure indicator to your table cell.

Option 2 is a lot of work and you maybe better off with option 1 if that's the only UILabel you have that you want to show > next to it.