标签:style blog http color sp for on div 2014
UIButton 一个控件 实现 左图标右文本的效果
如图,我们要实现一个 左边图标右边文本的效果,一般 可以考虑是 UIImageView + UILabel
不过,其实一个UIButton就可以搞定了
代码:
UIButton *tBtn = [UIButton buttonWithType:UIButtonTypeCustom]; tBtn.frame = CGRectMake(100, 100, 70, 30); [tBtn setImage:[UIImage imageNamed:@"good_red.png"] 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];
标签:style blog http color sp for on div 2014
原文地址:http://www.cnblogs.com/cocoajin/p/4126299.html