【发布时间】:2013-12-11 07:19:53
【问题描述】:
我正在 iOS 7 中制作自定义键盘,我希望按钮的背景颜色在用户点击时改变。但是,我无法获得这样做的按钮。在我分配给按钮的 IBAction 中,我使用的代码是
if(button.highlighted==YES){
button.backgroundColor = [UIColor blackColor]; //Change background color
button.titleLabel.textColor = [UIColor whiteColor]; //Change text color
}
我在这里做错了什么?我是否滥用“突出显示”?当我运行这段代码时,它似乎根本不会影响用户界面,我不确定用什么替换它。
【问题讨论】:
标签: iphone objective-c ios7 uibutton