0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

UIStackViewのdistributionの設定で迷った時のチートシート

Last updated at Posted at 2022-06-08

UIStackViewのdistributionはどれを使えば良いか

UIStackViewのdistributionの設定で
結局、どういう時にどれを使えば良いのか悩んだので一旦、備忘録として整理しました。

※ 前提としてAxisはVerticalを想定(縦に積まれているイメージ)
image.png

結論

  • 高さor比率が決まっているViewがUIStackView内に一つもない
    fillEqually ※同じ高さになるので注意
  • 高さor比率が決まっているViewがUIStackView内に存在し、View同士の間隔が決まっていない
  • 高さor比率が決まっているViewがUIStackView内に存在し、View同士の間隔が決まっている

equalSpacingはSpacingを設定すると、最小Spacingの設定値でView同士の間隔を担保してくれる

参考

Apple公式ドキュメント「UIStackView」

。。。てな感じでしょうか。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?