Adding unlimited lines in a Text (SwiftUI)

后端 未结 5 580
轮回少年
轮回少年 2020-12-06 04:53

Just figuring out how I can achieve multiple lines of text in a Text. It seems like the Text has the same default as UILabel (one line

5条回答
  •  悲哀的现实
    2020-12-06 05:46

    Use this:

    Text("Ingredients: Avocado, Almond Butter, Bread")
        .lineLimit(nil)
    

    If that doesn't work, use this method:

    Text("Ingredients: Avocado, Almond Butter, Bread")
        .fixedSize(horizontal: false, vertical: true)
    

提交回复
热议问题