Возможный дубликат:
UISegmentedControl выделенный цвет сегмента
появления UISegmentcontrol, вызывающие проблемы
Привет, я хотел бы изменить шрифт UISegmentControl по умолчанию на собственный шрифт и изменить цвет выбранного сегмента на другой цвет вместо более темного.
Благодарность
из этого
к этому
РЕДАКТИРОВАТЬ: решение называется
// изменить размер шрифта, удалить тень, выделенный текст и цвет фона отличаются от нормального состояния
-(void)defineSegmentControlStyle
{
//normal segment
NSDictionary *normalAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Rok" size:20.0],UITextAttributeFont,
[UIColor colorWithRed:75.0/255.0 green:75.0/255.0 blue:75.0/255.0 alpha:1.0], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil];//[NSDictionary dictionaryWithObject: [UIColor redColor]forKey:UITextAttributeTextColor];
[infoSegment setTitleTextAttributes:normalAttributes forState:UIControlStateNormal];
NSDictionary *selectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"Rok" size:20.0],UITextAttributeFont,
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor clearColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
nil] ;//[NSDictionary dictionaryWithObject: [UIColor redColor]forKey:UITextAttributeTextColor];
[infoSegment setTitleTextAttributes:selectedAttributes forState:UIControlStateSelected];
}