简体   繁体   English

UIButton .selected不覆盖按钮的整个宽度?

[英]UIButton .selected doesn't cover whole width of button?

Edit: Here is the screenshot: 编辑:这是截图:

截图

The button on the right is selected. 选择右侧的按钮。 I'd like the color to fill the entire button. 我希望颜色能够填满整个按钮。

The buttons are created on storyboard with widths pinned. 按钮在故事板上创建,宽度固定。 I simply toggle selected/not selected with 我只需切换选中/未选中

button.selected = YES;

I have not found any similar questions about adjusting the width of the part that is selected, and I haven't been able to figure out any solutions. 我没有发现任何关于调整所选部件宽度的类似问题,我也无法找出任何解决方案。 Any ideas? 有任何想法吗?

Make sure your UIButton 's type is "Custom", not "System". 确保您的UIButton的类型是“自定义”,而不是“系统”。

自定义按钮类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM