6

I have an application that needs to display a series of graphs (using Core Plot). I would like each of these graphs to be displayed in its own view preferably using a paged controller. I have 8 graphs.

Can someone direct me to a resource that shows how to implement something like this in iOS 5 with storyboards? I can't seem to find anything that explains this with storyboards at all..

Thanks,

Jack

Jack Nutkins
  • 1,555
  • 5
  • 36
  • 71

1 Answers1

8

It's quite easy. You just need to drag a UIScrollView into your controller, select it, and check the "Paging Enabled" option. You can also drag in a 'page control' and set yourself as the UIScrollViewDelegate Protocol delegate and update it when UIScrollView calls the -scrollViewDidScroll: method.

Don't forget to set your UIScrollView's delegate by Control+Drag from the UIScrollView to your ViewController.

Great tutorial on UIScrollView (Scroll down to "Paging with UIScrollView").
Apple's Documentation with PageControl example.

Armin
  • 1,150
  • 8
  • 24
  • Can we do this without a scroll view? I mean only using a page control? – Dinesh Jan 16 '14 at 17:59
  • No. UIPageControl is just a UI element that can be used with anything and not just a ScrollView. However, only UIScrollView has the `pagingEnabled` property which gives it the paging behaviour desired. You have to programmatically update the page of the UIPageControl. I hope that answers your question. – Armin Jan 17 '14 at 19:46
  • We can do so. You can have a look at this thread http://stackoverflow.com/questions/21171613/ios-load-and-switch-between-pages-using-uipagecontol/21172351#21172351. I followed the suggestions here and was able to do so without a scroll view but by using swipe gesture recognizer. – Dinesh Jan 17 '14 at 19:56
  • I see what you mean. I misunderstood your question. I thought you mean if you can only use UIPageControl to have the paging functionality, that's why I said UIPageControl "can be used with anything and not just a ScrollView". There would of course be many ways to replicate paging. – Armin Jan 17 '14 at 20:28