将内容UILabel包装在xCode中

Aug*_*rmo 6 xcode storyboard ios

我试图使将在同一行具有两个UILabel的单元格。像这样:

User Name: blablabla
Run Code Online (Sandbox Code Playgroud)

User Name第一个UILabel 在哪里blablabla,第二个UILabel 在哪里。

我希望第一个UILabel是换行内容,第二个UILabel要扩展其内容,直到超级视图出现为止。

我试图寻找有关StackOverflow的问题的答案,但找不到。有人知道我该怎么做到吗?


我想要这样的东西:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/first_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="User Name:"/>

    <TextView
        android:id="@+id/second_label"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="bla bla bla"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

或像这样

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/first_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="User Name:"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/second_label"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="bla bla bla"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toRightOf="@id/first_label"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

Kru*_*nal 4

尝试更改内容抗压缩优先级

看看这些快照:

带有默认值的标签content compression resistance priority

在此输入图像描述

我更改了content compression resistance priority标签blablabla blablabla,从750749

结果是:

在此输入图像描述