I am thinking of creating UIView classes and adding all views to single horizontal UIScrollView so that when we are done with one view and click next button, it slides to next view instead of creating multiple UIViewControllers and use UINavigationController to navigate to next page. .
Is it a good idea or causes performance issue? Can you please tell me which way is better and why?
I am thinking of creating UIView classes and adding all views to single horizontal
Share
You’re probably better off going with the navigation controller in terms of memory management. At least doing so will make that part of the process easier, but there’s no reason why you can’t do this with a scroll view, you just have to keep track of what elements are on and off screen so you can alloc/dealloc different objects at the right time.
However, if you do decide to go the scroll view route you can simple make buttons on your scroll view that adjust the scroll view’s content offset.x property to jump around between pages, and you can use this to set up the scroll view:
Simply add the number of pages you want as entries in the array below, and the scroll view will be dynamically adjusted to accommodate new views for every page.