Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案

Home Page:http://qmuiteam.com/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QMUIButton的bug

huhangatzz opened this issue · comments

Bug 表现
在给按钮设置背景后中间只展示一个图标时,这个图标无法放在背景的中心位置,会往右偏移.

截图
image

如何重现
QMUIButton button = [QMUIButton buttonWithType:UIButtonTypeCustom];
button.titleLabel.font = FontScale_14;
button.layer.cornerRadius = 15
ScreenScale;
button.layer.masksToBounds = YES;
[button setBackgroundImage:LQImageColor(LQRGBColor(0, 0, 0, 0.4)) forState:UIControlStateNormal];
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[button setImage:LQImage(defaultImgStr) forState:UIControlStateNormal];
[button addTarget:self action:@selector(clickButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:button];

预期的表现
正常情况下,应该是什么表现

其他信息
都有

无法复现,可考虑你的 icon 图是不是有问题。
image