FS.O5 FS.O5 - 3 months ago 9
iOS Question

Make UIButton both image and text tappable

I have a

UIButton
with text and an image that looks like this:

Button

But when I click the button it goes like this (just the image is selected instead of both the image and the text, I want button text also be selected.

Selected Button

How can I fix it?

Answer

Yes, you can set this color in your xib (interface builder) also, just select your button and inside State config select Highlighted and then set the textColor for that state. Check image for reference.

enter image description here