SSStackedPageView 0.0.4

SSStackedPageView 0.0.4

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.


Downloads

Total518
Week0
Month0

Installs

Apps27
Test Targets1
powered by Segment

GitHub

Stars276
Watchers19
Forks42
Issues6
Contributors2
Pull Requests1

Code

Files2
LOCLines of Code 298



  • By
  • PlenipotentSS

Inspired by Passport App and Reminders App for iOS 7, this is designed to have a stacked page view that uses reusable pages for efficiency. Easily scroll through UIImageViews, UIViews or your custom View with this one do-it-all class.

SSStackedPageView uses a scroll view to manage through your large list of views. By either selecting or dragging the view up, you divide the stack and highlight that view. Each view is customized to the length of the SSStackedPageView. For efficiency, I make use of a reusable array of pages so that scrolling is fast and beautiful.

Implementation:

This class has the delegate SSStackedViewDelegate that has the following methods:

///method for setting the current page at the index
- (UIView*)stackView:(SSStackedPageView *)stackView pageForIndex:(NSInteger)index;

///total number of pages to present in the stack
- (NSInteger)numberOfPagesForStackView:(SSStackedPageView *)stackView;

///handler for when a page is selected
- (void)stackView:(SSStackedPageView *)stackView selectedPageAtIndex:(NSInteger) index;

All three are required to create the stacked view. The first stackView:pageForIndex is most similar to tableView:rowForIndexPath: in that you'll want to presen tthe view that will be presented for that index. Next is the somewhat trivial numberOfPagesForStackView: which simply informs the StackedPageView how many elements to expect (and how many times stackView:pageForIndex is called).

Lastly, we have stackView:selectedPageAtIndex: method which will be your handler for when the page is selected.

Known Bugs:

  • Rotation brings odd results when pages are reused. Please Fork and Pull request if you find a solution or other bugs.

Thanks, and Enjoy!