设定UISegmentControl的文字属性

来源:互联网 发布:qq炫舞 mac 编辑:程序博客网 时间:2024/05/16 04:40

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


0 0