【发布时间】:2015-05-28 13:32:11
【问题描述】:
嘿,我正在开发一个小应用程序,它根据日期选择器的当前状态更改 UIButton 的文本。它要么会显示“今天是哪一天?”或“今天是哪一天?”。但是对于 xcode 6.3 beta,UIButton SetTitle 方法似乎不存在。相反,我尝试将字符串分配给 titleLabel.txt,但这不会更改按钮文本。
方法如下:
(IBAction) changeButton:(id)sender {
NSDate *currentDate = [self.datePicker date];
NSDate *now = [NSDate date];
if(currentDate<now){
self.whatButton.titleLabel.text = @"What day was it?";
}
else {
self.whatButton.titleLabel.text = @"What day will it be?";
}
我已经看到 setTitle 方法可能是一种解决方案,但发现库可能已更改。任何建议将不胜感激!
【问题讨论】:
标签: ios objective-c uibutton xcode6