我在TVos
應用程序中有一個UIButton
應用程序,我想要更改backgroundColor
以及titleLabel的字體。UIButton在tvOS中的自定義backgroundColor
當按鈕變爲焦點時,文本,字體和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
中設置的顏色。
對此有何幫助?
它的伎倆。但是,你不能以任何方式在一條線上做到這一點嗎? – Steaphann
據商務部說 FUNC了setBackgroundImage(_圖像:UIImage的? forState狀態:UIControlState) 我們在一次只能有一個狀態來指定, –
如果它的伎倆,請接受答案:) –