【发布时间】:2016-04-07 19:43:20
【问题描述】:
我的TVos 应用程序中有一个UIButton,我想在其中更改backgroundColor 以及titleLabel 的字体。
当按钮获得焦点时,文本、字体和backgroundColor 应该相同,但应该显示它变成focused view。
我的ViewDidLoad 中有这三行代码:
orderButton.titleLabel?.font = UIFont(name: "RobotoCondensed-Regular", size: 40)
orderButton.setBackgroundImage(getImageWithColor(UIColor(rgba: "#1db5b5")), forState: [.Focused, .Normal])
orderButton.setTitleColor(UIColor.whiteColor(), forState: [.Focused, .Normal])
问题
当我的视图被加载时,我的按钮仍然是默认的灰色。当它获得焦点时,它会获得我在ViewDidLoad 中设置的颜色。
有什么帮助吗?
【问题讨论】:
标签: ios swift uibutton swift2 tvos