プログラミングスクール最大70%OFF! ←クリックして見に行く

【Warning】Auto Layout Localization:Fixed width constraints may cause clipping.

【Warning】Auto Layout Localization:Fixed width constraints may cause clipping.

エラー解消方法の備忘録_φ(・_・ )

発生したエラー

Fixed width constraints may cause clipping.

翻訳

固定幅の制約により、クリッピングが発生する場合があります

原因

これは物体の幅に対するConstraint警告であり、
選択肢2つの警告はラベルに対して、
選択肢3つの警告はボタンに対して出ます。

選択肢2つの警告(ラベルに対して)


・選択肢1 : Use Fixed Leading and Resizing Trailing Constraints
Adjust to include a fixed leading constraint and a trailing constraint with a constant ≧ standard space. Recommended if the view is on the left half of the parrent view.
↓翻訳
・選択肢1:行頭固定・行末サイズ変更制約の使用
固定先行制約と定数 ≧ 標準スペースによる後続制約を含むように調整する。ビューがパレントビューの左半分にある場合に推奨します。

・選択肢2 : Use Resizing Leading and Fixed Trailing Constraints
Adjust to include a leading constraint with a constraint ≧ standard space and a fixed trailing constraint. Recommended if the view is on the right half of the parrent view.
↓翻訳
・選択肢2 : リサイズされた先行制約と固定された後行制約を使用する
制約 ≧ 標準スペースで先行制約、固定で後行制約を含むように調整します。ビューがパレントビューの右半分にある場合に推奨します。

選択肢3つの警告(ボタンに対して)


・選択肢1 : Remove Constraint
If there are appropriate leading and trailing Constraints, a fixed width may not be necessary
↓翻訳
・選択肢1:制約の解除
適切な先行・後続のConstraintsがあれば、固定幅は必要ない場合があります。

選択肢2 : Set Constraint to ≥ Current Width
This allows the label to extend in width with longer text while preserving the current layout
↓翻訳
・選択肢2:制約条件を≧現在の幅に設定する
これにより、現在のレイアウトを維持したまま、ラベルの幅を拡張してテキストを長くすることができます。

選択肢3 : Set Constraint to ≥ Minimum Width
Make sure the button does not shrink below the platform-recommended minimum for localizations that include short translations
↓翻訳
・選択肢3:制約条件を≧最小幅に設定する
短い翻訳を含むローカライズのために、ボタンがプラットフォームで推奨される最小値よりも縮小しないことを確認します。

解決手順

・該当のStoryBoard右上の警告マーク > Warning文をクリック

・Show the Size inspector を開く

・Reration を [Equal] から [Greater Than or Equal]

参考サイト

https://samekard.blogspot.com/2017/09/auto-layout.html
https://qiita.com/onishi_820/items/b8fe02a07581f85d208d

Swiftカテゴリの最新記事