vin*_*nay 5 size fonts uisegmentedcontrol ios
以下是初始化我的代码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];
}
Run Code Online (Sandbox Code Playgroud)
如何减少每个项目的字体大小UISegmentedControl?
注意: toolButtons已经在全球范围内声明.
Sig*_*ini 13
非常简单:
UIFont *Boldfont = [UIFont boldSystemFontOfSize:16.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:Boldfont forKey:UITextAttributeFont];
[segment setTitleTextAttributes:attributes forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
考虑重新设计您的界面或使用字体较小的“选项卡”样式。弄乱未公开的属性可能会导致您的应用程序被拒绝,或者如果它们在幕后更改了某些内容,则可能会破坏您的应用程序。
例如,给出的代码示例不起作用。当您点击某个片段时,该片段的字体将重置为其正常大小。如果您执行的操作偏离了这些内容的正常使用方式,那么您的应用程序中可能会发生或更改任何不可预测的情况。因此,如果您想要一个在后续操作系统更新中继续工作的应用程序,请坚持使用标准内容,或者使用 UIButtons 和矩形背景图像制作自己的控件。黑客现在可能会起作用,但并不意味着将来就会起作用。