LoginSignup
0
2

More than 3 years have passed since last update.

Xibファイルの高さを自動調整する

Posted at

XibファイルをViewに埋め込んだ時に、高さを文字数などによって自動調整したい場合の方法。

非自動調整時:
緑のViewが途中で切れてしまっている。
Simulator Screen Shot - iPhone 11 Pro Max - 2020-10-24 at 11.52.06.png

自動調整後:
緑のViewが最後まで表示されている。
Simulator Screen Shot - iPhone 11 Pro Max - 2020-10-24 at 11.52.46.png

【解決方法】
StoryBoard上で埋め込んでいるXibファイルを表示するViewの設定を下記のように変更。
Layout→Autoresizing Mask
スクリーンショット 2020-10-24 11.49.59.png
Autoresizingで自動調整して欲しい拘束を設定。
スクリーンショット 2020-10-24 11.50.08.png

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2