我有一个UIButton
文本"探索应用程序"和UIImage
(>)在Interface Builder
它看起来像:
[ (>) Explore the app ]
Run Code Online (Sandbox Code Playgroud)
但我需要UIImage
在文本之后放置:
[ Explore the app (>) ]
Run Code Online (Sandbox Code Playgroud)
我怎样才能UIImage
向右移动?
我在添加左侧填充时遇到问题UIButton
.我有一个UIButton
带UIControlContentHorizontalAlignmentLeft
.我希望文本显示在左侧,但它太左了.当我给边框时,它看起来不太好.我想在CSS中给出一些关于5px的文本填充.我用谷歌搜索解决方案,但找不到一个特别适合UIButton
.在此先感谢您的帮助.
如何删除留下padding
的UIButton
?
我已经用以下代码创建了按钮:
let button = UIButton(...)
button.setImage(UIImage(named: "plus")?.withRenderingMode(.alwaysTemplate), for: .normal)
button.setTitle("Text", for: .normal)
button.layer.cornerRadius = 8
button.layer.backgroundColor = UIColor.red.cgColor
Run Code Online (Sandbox Code Playgroud)
我正在搜索这篇文章并试图自己解决这个问题,但它几乎没有用.
我想UIButton
用图像和标题.
UIButton
横跨(几乎)整个屏幕.
图像应位于按钮的右边缘.
标题应该在整个按钮中居中.
如何用插图做到这一点?