//给某个按钮上的数字设置大小
+ (void)setDefaultFont:(id)sender size:(float)size{
[sender setFont:[UIFont fontWithName:@"Helvetica" size:size]];
}
用法:
-(void)initButton
{
UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 100, 100, 50)];
[rightButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
rightButton.backgroundColor=[UIColor redColor];
//给按钮上的字设置大小
[Utils setDefaultFont:rightButton size:20];
[rightButton setTitle:@"完成" forState:UIControlStateNormal];
[self.view addSubview:rightButton];
}
定义某个按钮上的文字
时间: 2024-09-28 04:09:19