[weixinbtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 10)];分别上向下、右、上、左偏移~~~~
//微信登录
UIButton *weixinbtn = [UIButton buttonWithType:UIButtonTypeSystem];
weixinbtn.layer.cornerRadius = 5;
weixinbtn.clipsToBounds = YES;
[weixinbtn setTitle:@"微信登录" forState:UIControlStateNormal];
[weixinbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[weixinbtn setImage:[[UIImage imageNamed:@"weixin"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ] forState:UIControlStateNormal];
[weixinbtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 10)];
[weixinbtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 10, 0, 0)];
weixinbtn.backgroundColor = [UIColor colorWithHexString:@"73D7BF"];
[self addSubview:weixinbtn];
本文介绍如何使用Objective-C创建并自定义微信登录按钮的样式,包括设置圆角、背景颜色及图片、文字颜色等属性。
1208

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



