Reputation: 960
Which one is good to use for a page based design, Pageviewcontroller
or UIScrollview
with paging.
Which will consume less memory? I have done it via UIScrollview
; but it's consuming very huge memory. Any help will be greatly appreciated.
Upvotes: 0
Views: 115
Reputation: 3399
Using UIScrollView
for the application is not a handy task. For iOS 6, you should use UIPageViewController
. But for iOS 5, UIPageViewController
is not be good as it only provides scrolling for the page transition.
You may reuse the UIScrollView
views then,
Many examples are there in SO like this
Upvotes: 1
Reputation: 114793
It is hard to say which is "best" - it depends on what makes sense for your app. Which ever approach you choose you can minimise memory consumption by "lazy loading" content into the scroll view when it is needed. For example, if you were displaying pages of images and the images are stored as files in your app then you should only add the current image and the image either side of the current image. As you scroll you can load and add the next image and release.
Here is a tutorial that shows this approach with UIScrollView- Multiple virtual pages in a UIScrollView with just 2 child views
UIPageViewController makes it a bit simpler by adopting a dataSource pattern, so you can concentrate on responding to data requests and not have to worry about manipulating the views.
Upvotes: 0