【问题标题】:Xcode Storyboard - making the text rtl with font-awesomeXcode Storyboard - 使用 font-awesome 制作文本 rtl
【发布时间】:2019-05-06 00:14:27
【问题描述】:

我想在我的按钮文本中使用来自 font-awesome 的图标和旁边的文本。

我使用的是希伯来语文本。我需要图标位于文本的右侧(不像英语,您首先有图标,然后是文本)。

无论我做了什么,我都没有成功。

我只是为文本寻找某种 RTL 属性(可能是 XML 格式),但我找不到类似的东西。

同样,我不是在寻找对整个故事板的 RTL 支持。我只是在寻找 RTL 文本(在按钮或标签上)。

如何获得?

【问题讨论】:

    标签: ios swift storyboard font-awesome


    【解决方案1】:

    你可以通过代码试试这个:

       UIView.appearance().semanticContentAttribute = .forceRightToLeft
    

    或按照步骤在情节提要中进行更改

    Xcode -> Edit Scheme -> Run -> Options -> Application Language -> Right-to-Left 伪语言。

    查看更多详情:

    https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/SupportingRight-To-LeftLanguages/SupportingRight-To-LeftLanguages.html

    希望这会有所帮助!

    【讨论】:

    • 这没有帮助。无论运行方案如何,我都需要更改按钮上的文本。我需要一些方法来更改从 font-awesome 中获取的图标及其旁边的文本的顺序,以便图标将出现在文本的右侧。
    【解决方案2】:
        let exercises_heb = "תרגילים"
        let fa_cubes = "" // this is a Font Awesome character for cubes
        let space = " "
        let unicode_rtl = "\u{202B}"
    
        ExercisesButton.setTitle(unicode_rtl+fa_cubes+space+exercises_heb, for: .normal)
    

    【讨论】:

      猜你喜欢
      • 2021-05-23
      • 1970-01-01
      • 2019-11-14
      • 1970-01-01
      • 2012-06-18
      • 2013-08-11
      • 2018-11-23
      • 2015-04-19
      • 2015-07-31
      相关资源
      最近更新 更多