以编程方式设置 UIButton 的按钮类型
我在 IB 中添加了一个 UIButton
,但是此按钮后面的视图会更改颜色,我需要在 InfoDark 和 InfoLight< 之间切换按钮的类型/em>.但奇怪的是,buttonType
属性是只读的。那么如何在明暗信息按钮之间切换呢?
I have a UIButton
which I've added in IB, however the view behind this button changes color and I need to switch the button's type between InfoDark and InfoLight. Bizarrely though, buttonType
property is read only. So how can i switch between light and dark info buttons?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法设置 buttonType readonly 属性,使用以下内容可能会有所帮助:
You can't set buttonType readonly property, use below may help:
.buttonType
一旦设置,就无法更改。您可以准备两个按钮,并根据背景颜色隐藏其中一个。
There's no way to change the
.buttonType
once it's set.You can prepare two buttons, and hide one of them depending on the background color.