使UIButton图像和文本tappable [英] Make UIButton both image and text tappable

查看:68
本文介绍了使UIButton图像和文本tappable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIButton ,文字和图片如下:

I have a UIButton with text and an image that looks like this:

但是当我点击按钮时,它会这样(只选择图像而不是图像和文本,我想按钮文字也是

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.

如何解决? p>

How can I fix it?

推荐答案

,您可以在 xib (界面构建器)也只需选择您的按钮,并且状态配置选择突出显示 code> textColor ,查看图片以供参考。

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.

这篇关于使UIButton图像和文本tappable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆