gpt4 book ai didi

ios按钮仅在点击时显示图像

转载 作者:行者123 更新时间:2023-11-30 11:30:06 25 4
gpt4 key购买 nike

我有以下代码用于在按钮上设置图像:

button.setImage(UIImage(named: "X", in: getBundleForCommon(), compatibleWith: nil)?.withRenderingMode(.alwaysTemplate), for: .normal)

但是图像仅在点击按钮时出现在按钮上,然后消失。

如何才能在按钮上持久保留图像,并且在点击时不受影响。

最佳答案

试试这个,

button.setImage(UIImage(named:"x"), for: .normal)
button.setImage(UIImage(named:"x"), for: .highlighted)

关于ios按钮仅在点击时显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50342752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com