我已经编写了这段代码来为 UISegmentedControl 设置正常状态和突出显示状态的字体属性,但它不起作用。请帮我指出原因。
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica" size:12.0f], UITextAttributeFont,
[UIColor blackColor], UITextAttributeTextColor,
nil];
NSDictionary *boldAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIFont fontWithName:@"Helvetica-Bold" size:12.0f], UITextAttributeFont,
[UIColor blackColor], UITextAttributeTextColor,
nil];
[self.tab setTitleTextAttributes:attributes forState:UIControlStateNormal];
[self.tab setTitleTextAttributes:boldAttributes forState:UIControlStateHighlighted];
我希望所选文本为粗体,否则应该是正常的。