UIButton * btn=[[UIButton alloc] initWithFrame:CGRectMake(5, 5,50,30)];
[btn setTitle:@"xxx" forState:UIControlStateNormal];
btn.backgroundColor=YYColor(247, 247, 247);
[btn setTitleColor:YYColor(234, 167, 39) forState:UIControlStateNormal];
btn.font=[UIFont systemFontOfSize:15];
//粗体
[btn setFont :[ UIFont fontWithName : @”Helvetica-Bold” size : 15 ]];
[self.view addSubview:btn];
//边框线
btn.layer.borderWidth = 1;
btn.layer.borderColor = [[UIColor grayColor] CGColor];
本文介绍如何使用UIButton创建一个具有特定样式的按钮。包括设置按钮标题、背景颜色、文字颜色、字体及边框等属性。
6万+

被折叠的 条评论
为什么被折叠?



