iOS7の環境においてUISegmentedControlのtextの色を変更するにはどうすればいいのだろうか?
How to change font color of UISegmentedControlを読むと次のように変更すればいいことがわかる。
UISegmentedControl *segmentedControl;
NSDictionary *attributes = @{UITextAttributeTextColor:[UIColor blackColor]];
[segmentedControl setTitleTextAttributes:attributes forState:UIControlStateNormal];
NSDictionary *selectedAttributes = @{UITextAttributeTextColor:[UIColor whiteColor]};
[segmentedControl setTitleTextAttributes:highlightedAttributes forState:UIControlStateSelected];こうしてまとめておけば後で見返せるので便利ですねー。
0 コメント:
コメントを投稿