美文网首页
UIButton 图片文字位置对调

UIButton 图片文字位置对调

作者: 冰霜海胆 | 来源:发表于2023-04-05 15:22 被阅读0次

将 UIButton 中左侧的图片位置更改到文字的右侧,将文字未知更改为左侧。
可以使用系统对“阿拉伯语”或“希伯来语”等本地化 UI 适配时从右向左阅读的特性,来实现 UIButton 的图片文字位置对调。

button.semanticContentAttribute = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft ? .forceLeftToRight : .forceRightToLeft 

相关文章

网友评论

      本文标题:UIButton 图片文字位置对调

      本文链接:https://www.haomeiwen.com/subject/xzneddtx.html