> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swiftui/control/text/format/no-wrap.md).

# no wrap

╱🚧 under construction ->

[SwiftUI](/ios/swiftui.md) ⟩ [controls](/ios/swiftui/control.md) ⟩ [Text](/ios/swiftui/control/text.md) ⟩ [format](/ios/swiftui/control/text/format.md) ⟩ no wrap &#x20;

{% hint style="info" %}
文字<mark style="color:yellow;">不折行</mark>顯示。
{% endhint %}

{% tabs %}
{% tab title="💾 程式" %}

```swift
// text: no wrap
Text("It's a long long story ...")
    .fixedSize()            // ⭐️ 將文字限制在它原有的尺寸(不動態調整)

// 下面的做法雖然類似，但因為文字會被省略 (就算不指定 .truncationMode 也是如此)
// 因此效果通常不理想。
Text("It's a long long story ...")
    .lineLimit(1)           // 限制行數為 1
    .truncationMode(.tail)  // 使用省略號顯示超出部分（可選 .head, .middle, .tail）
```

{% endtab %}

{% tab title="👥 相關" %}

* [ideal size](/ios/swiftui/view/layout/view-size/ideal-size.md)：一個視圖原有的尺寸。
  {% endtab %}

{% tab title="⬇️ 應用" %}

* [system colors](/ios/custom/ext/color+/system.md)
  {% endtab %}

{% tab title="📘 手冊" %}

* [SwiftUI](https://developer.apple.com/documentation/swiftui) ⟩ [View](https://developer.apple.com/documentation/swiftui/view) ⟩&#x20;
  * [.fixedSize()](https://developer.apple.com/documentation/swiftui/view/fixedsize\(\))：Fixes view at its [ideal size](/ios/swiftui/view/layout/view-size/ideal-size.md). (both width and height)
  * [.fixedSize(horizontal:vertical:)](https://developer.apple.com/documentation/swiftui/view/fixedsize\(horizontal:vertical:\))：Fixes view at its [ideal size](/ios/swiftui/view/layout/view-size/ideal-size.md) <mark style="color:yellow;">in the specified dimensions</mark>.
    {% endtab %}
    {% endtabs %}
