//单纯的字体显示 设置字体的大小 [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// 重拍、删除
for (int i=0; i<2; i++) {
UIButton *btn = [UIButton buttonWithType:0];
btn.frame = CGRectMake((CGRectGetWidth(_contentView.frame)/2+0.5)*i,
0,
CGRectGetWidth(_contentView.frame)/2-0.5, 38);
btn.backgroundColor = THEME_COLOR;
btn.tag = 100+i;
[_contentView addSubview:btn];
// icon (18,18)
CGFloat icon_w = (i==0? 19: 14);
CGFloat icon_H = (i==0? 16: 17);
btn.imageEdgeInsets = UIEdgeInsetsMake((CGRectGetHeight(btn.frame)-icon_H)/2,
55,
(CGRectGetHeight(btn.frame)-icon_H)/2,
CGRectGetWidth(btn.frame)-55-icon_w);
NSString *imageStr = (i==0? @"mine_video_reset": @"mine_video_delete");
[btn setImage:LOAD_IMAGE(imageStr) forState:UIControlStateNormal];
[btn setTitle:(i==0? @"重拍": @"删除") forState:UIControlStateNormal];
btn.titleLabel.font = [UIFont systemFontOfSize:15];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateHighlighted];
[btn addTarget:self action:@selector(playOrDelete:) forControlEvents:UIControlEventTouchUpInside];
}
效果图:
网友评论