LoginSignup
4
3

More than 5 years have passed since last update.

StoryboardでUIScrollViewとUIPageControlを連携させるときの注意点

Last updated at Posted at 2013-05-18

StoryboardでUIScrollViewを使ってページ遷移を実装したあと、
UIPageControlを追加してページ数や現在のページが
分かるように機能拡張したときにハマったので、その解決方法を書いておきます。

1つのViewにUIScrollViewを追加すると、
[View Controller Scene]はこうなっていると思います。
▼View Controller
 ▼View
  ▼Scroll View

この状態で、UIPageControlを追加すると、
UIScrollViewの上に乗せる事になります。
このときの[View Controller Scene]はこうなっています。
▼View Controller
 ▼View
  ▼Scroll View
   ▼Page Control

これで実行するとSigabrtします。

以下のようにViewの直下に置くと意図した動きになります。
▼View Controller
 ▼View
  ▼Scroll View
  ▼Page Control

やり方は、[View Controller Scene]上で"Page Control"を"View"の下に
ドラッグ&ドロップするだけです。

4
3
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
4
3