Tencent / QMUI_iOS

QMUI iOS——致力于提高项目 UI 开发效率的解决方案
http://qmuiteam.com/ios
Other
7.05k stars 1.37k forks source link

QMUIButton的bug #1524

Closed huhangatzz closed 9 months ago

huhangatzz commented 9 months ago

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

截图 image

如何重现 QMUIButton button = [QMUIButton buttonWithType:UIButtonTypeCustom]; button.titleLabel.font = FontScale_14; button.layer.cornerRadius = 15ScreenScale; 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];

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

其他信息 都有

MoLice commented 9 months ago

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

image