1
1

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.

StoryboardでUIScrollViewをデザインする為のスニペット

Posted at

はじめに

次の仕様で、制約エラーの無い状態のUIScrollViewを配置する手順です。

  • 横スクロール無し
  • 縦スクロールあり
  • UIScrollView.size.heightは少なくとも親View.bounds.size.height以上

手順

すべてStoryboard上で行う操作です。
Superviewは対象のviewを配置している親viewです。

  1. UIScrollViewを配置する(以降scrollView)
  2. scrollView.trailing = Superview.trailing
  3. scrollView.leading = Superview.leading
  4. scrollView.bottom = Superview.bottom
  5. scrollView.top = Superview.top
  6. scrollViewにUIViewを配置する(以降contentView)
  7. contentView.trailing = scrollView.ContentLayoutGuide.trailing
  8. contentView.leading = scrollView.ContentLayoutGuide.leading
  9. contentView.bottom = scrollView.ContentLayoutGuide.bottom
  10. contentView.top = scrollView.ContentLayoutGuide.top
  11. contentView.width = scrollView.FrameLayoutGuide.width
  12. contentView.height ≧ scrollView.FrameLayoutGuide.height
  13. contentView.height = scrollView.FrameLayoutGuide.height(Priority = 250)
1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?