設定UISegmentControl的文字屬性

設定UISegmentControl中選中和未選中的segment的文字的屬性,包括font, textcolor, shadowcolor.

UIFont *font = [UIFontType06];

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font,UITextAttributeFont,

[UIColor grayColor],UITextAttributeTextColor,

[UIColorcolorFromHex:0x333333],UITextAttributeTextShadowColor,

nil];

[self.segControl setTitleTextAttributes:attributes forState:UIControlStateNormal];

NSDictionary *selectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:

font,UITextAttributeFont,

[UIColor whiteColor],UITextAttributeTextColor,

[UIColorcolorFromHex:0x333333],UITextAttributeTextShadowColor,nil];

[self.segControl setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章