2016-10-12 6 views
0

tvOSのフォントサイズをUISegementedControlに変更しようとしています(役立つ場合)。デフォルトでは、フォントは巨大です!私はそのようにそれを減らすことができましたUISegementedControlフォントサイズ

let switchAttributes = [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.systemFont(ofSize: 28)] 
segementedControl.setTitleTextAttributes(switchAttributes, for: .normal) 

しかし、これはその.normal州だけに影響するようです。他のすべての州がこれによって影響を受けたようには見えません、また彼らのテキストを指定することにより、属性:

segementedControl.setTitleTextAttributes(switchAttributes, for: .selected) // No effect 
segementedControl.setTitleTextAttributes(switchAttributes, for: .focused) // No effect 
ここ

enter image description here

あなたが巨大な集中と選択された状態が

私はこれを知っているかを確認することができます私のコードは以前はうまくいきましたが、tvOS 10がすべて更新されて以来、この問題を解決する方法はありませんでした。おそらくAppleのバグだけど、何か不足しているのだろうか?

何か助けていただければ幸いです。

答えて

0

はこれを試してみてください:私は

+0

それをテストしたときに私のために働いた

let font = UIFont.boldSystemFont(ofSize: 8.0) let attributes = [ NSFontAttributeName : font ] segmentedControl.setTitleTextAttributes(attributes, for: .selected) 

は、それが働いた、ありがとうございます! – kernelpanic

+0

Np、@カーネルパニックに役立ててうれしい –