titleLabel?.text 不改变 ios 10 UIControlState [英] titleLabel?.text dont change ios 10 UIControlState

查看:29
本文介绍了titleLabel?.text 不改变 ios 10 UIControlState的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试在 swift 3 和 iOS 10 中更改按钮标题,但它没有更改.我的代码很清楚,这是一个错误吗?

@IBOutlet 弱变量电话:UIButton!tel.titleLabel?.text = "+1 123 23 34"打印(电话 = \(电话)")

<块引用>

什么都没有显示!而且按钮标题不会改变!

这是一个错误吗?代码看起来很清晰

解决方案

是的,我终于找到了 iOS 10 控件状态工作代码.

tel.setTitle("按钮标题", for: [])

我认为这会帮助很多人.

I want to try to change a button title in swift 3 and iOS 10, but it doesn't change. My codes clear, is this a bug ?

@IBOutlet weak var tel: UIButton!
tel.titleLabel?.text = "+1 123 23 34"

print("tel = \(tel)")

Nothing shows ! And button title doesn't change !

Is this a bug ? Codes looking clear

解决方案

Yeah, I finally found iOS 10 control state working code.

tel.setTitle("Button Title",  for: [])

I think this will help many people.

这篇关于titleLabel?.text 不改变 ios 10 UIControlState的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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