IOS中UIButton文字居左图标居右的写法

let button = UIButton(frame:myframe)
button.semanticContentAttribute = .forceRightToLeft
就简单的设置一个属性就可以做到,如果希望文字和图标之间有间距就直接在文字后边添加空格直到调
到你想要的距离
0 0 vote
Article Rating
Subscribe
提醒
guest
1 评论
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
niu

saved my day!

1
0
Would love your thoughts, please comment.x
()
x