以下是初始化我的代码UISegmentedControl
。如何更改UISegmentedControl上文本的字体大小?
- (void)initializeToolButtons
{
NSArray *buttonTitles = [NSArray arrayWithObjects:@"ANNEXET", @"HOVET", @"GLOBEN", "ALL", nil];
toolbuttons = [[UISegmentedControl alloc] initWithItems:buttonTitles];
toolbuttons.segmentedControlStyle = UISegmentedControlStyleBar;
toolbuttons.tintColor = [UIColor darkGrayColor];
toolbuttons.backgroundColor = [UIColor blackColor];
toolbuttons.frame = CGRectMake(0, 0, 320, 30);
[toolbuttons addTarget:self action:@selector(toolButtonsAction) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:toolbuttons];
}
我怎样才能减少字体大小在UISegmentedControl
每个项目?
注:toolButtons
已经全局声明。
这适用于iOS 5及以上版本。 – adbie 2012-11-22 06:57:44
在iOS 7.0中使用NSFontAttributeName – Stavash 2014-01-06 14:59:34