【问题标题】:Putting UIImage in between UILabels text将 UIImage 放在 UILabels 文本之间
【发布时间】:2018-05-31 12:49:20
【问题描述】:

目前我使用此约束来显示用户的通知。

User Name.leading = User Image.trailing + 5
Status Image.leading = User Name.trailing + 2
Status Image.centerY = User Name.centerY
Notification Message.leading = Status Image.trailing + 3
Notification Message.trailing ≤ Notification Post.leading - 3
trailing = Notification Post.trailing + 5

它给了我这个结果:

但是当行数大于 1 时,我希望通知消息左对齐。我该如何实现?当我对 UserName 和 NotificationMessage 使用 2 个不同的 UILabel 时是否有可能? 我需要做的实际UI位置在这里:

我怎样才能做到这一点?如果有任何想法,我将不胜感激。

【问题讨论】:

  • NSAttributedString

标签: ios swift autolayout nslayoutconstraint


【解决方案1】:

使用一个标签来实现这一点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-22
    • 1970-01-01
    • 2014-12-30
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多