您的位置:首页 > 产品设计 > UI/UE

iOS UIButton上同时加图片和标题,设置偏移

2016-04-14 18:08 162 查看
[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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios uibutton 偏移