<分区>
<分区>
我正在尝试以编程方式更改按钮标题的文本(按钮附加到 IBoutlet)但是每当我尝试执行代码时 _button.titlelabel = @"example text"
它不起作用!请帮我! ( objective-c )
最佳答案
应该是这样的:
对于 Objective-C :
[_button setTitle:@"example text" forState:UIControlStateNormal];
对于 swift :
_button.setTitle("example Text", forState: UIControlState.Normal)
关于ios - 以编程方式更改按钮文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42590879/
相关文章:
ios - Swift - 在 init() 中使用 UIButton.addTarget 时崩溃
iphone - 如何一起使用 xib 和 UIView 子类?
iphone - 核心数据迁移 : methods in NSEntityMigrationPolicy not called.
objective-c - 当模拟器从 XCode 关闭时,是否有运行的方法?
ios - UITableView 内的自定义 UIButton 在按下后保持突出显示
ios - CloudKit - 在 CKRecord 中存储多个 CKReferences