设定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];


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