我想消除 UIButton 图像的顶部和 UIButton 的顶部边框以及 UIButton 图像的底部和 UIButton 的底部边框之间的间距(请参阅附图)。
我尝试使用以下代码,但没有成功:
newFileButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
newFileButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
newFileButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
非常感谢任何建议。
问候, 沙迪。
最佳答案
默认情况下,插图为零。要消除内部空间,请添加负插图。
newFileButton.imageEdgeInsets = UIEdgeInsets(top: -4, left: 0, bottom: -4, right: 0)
关于swift - 如何消除 UIButton 图像和 UIButton 边框之间的填充?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56534139/