UIImage *buttonImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:str]]];
_button.tintColor = UIColorFromRGB(0x52b0da);//设置新的颜色
//取消图片原来的颜色
[_button setImage:[buttonImage imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)] forState:(UIControlStateNormal)];
UIButton *button = [UIButton alloc] initWithFrame:CGRect(100, 100, 100 , 100)];
//设置边框颜色
button.layer.borderColor = [[UIColor redColor] CGColor];
//设置边框宽度
button.layer.borderWidth = 1.0f;
//给按钮设置角的弧度
button.layer.cornerRadius = 4.0f;
//设置背景颜色
button.backgroundColor = [UIColor redColor];
button.layer.masksToBounds = YES;
作者:代码干货
链接:http://www.jianshu.com/p/0cfd3c9b90f6
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
网友评论