作者:我是一只快乐的小鸟宝宝 | 来源:互联网 | 2023-05-16 22:56
UIButton一个控件实现左图标右文本的效果如图,我们要实现一个左边图标右边文本的效果,一般可以考虑是UIImageView+UILabel不过,其实一个UIButton就可
UIButton 一个控件 实现 左图标右文本的效果
如图,我们要实现一个 左边图标右边文本的效果,一般 可以考虑是 UIImageView + UILabel
不过,其实一个UIButton就可以搞定了
] forState:UIControlStateNormal];
[tBtn setTitle:@"11" forState:UIControlStateNormal];
// [tBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 20, 0, 20)];
[tBtn setTitleEdgeInsets:UIEdgeInsetsMake(13, 0, 0, 0)];
[tBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
[self.view addSubview:tBtn];