Skip to content

Commit

Permalink
use a floating point based index to track state; now correctly docks …
Browse files Browse the repository at this point in the history
…on right screen area as its own step
  • Loading branch information
steipete committed Sep 18, 2011
1 parent 7cc590e commit f637184
Show file tree
Hide file tree
Showing 2 changed files with 430 additions and 273 deletions.
14 changes: 8 additions & 6 deletions PSStackedView/PSStackedViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ enum {
NSUInteger largeLeftInset_;

// stack state
BOOL showingFullMenu_;
NSInteger firstVisibleIndex_;
CGFloat floatIndex_;
NSMutableArray *viewControllers_;

// internal drag state handling and other messy details
Expand Down Expand Up @@ -76,10 +75,10 @@ enum {
- (NSUInteger)canExpandStack;

/// moves view controller stack to the left, potentially hiding older VCs (increases firstVisibleIndex)
- (NSUInteger)collapseStack:(NSUInteger)steps animated:(BOOL)animated;
- (NSUInteger)collapseStack:(NSInteger)steps animated:(BOOL)animated;

/// move view controller stack to the right, showing older VCs (decreases firstVisibleIndex)
- (NSUInteger)expandStack:(NSUInteger)steps animated:(BOOL)animated;
- (NSUInteger)expandStack:(NSInteger)steps animated:(BOOL)animated;

/// align stack to nearest grid
- (void)alignStackAnimated:(BOOL)animated;
Expand All @@ -103,12 +102,15 @@ enum {
/// first view controller
@property(nonatomic, readonly, retain) UIViewController *firstViewController;

/// represents current state via floating point. shows edge attaches, menu docking, etc
@property(nonatomic, readonly, assign) CGFloat floatIndex;

/// view controllers visible. NOT KVO compliant, is calculated on demand.
@property(nonatomic, readonly, retain) NSArray *visibleViewControllers;

@property(nonatomic, readonly, retain) NSArray *fullyVisibleViewControllers;

/// index of first currently visible view controller [state]
/// index of first currently visible view controller [calculated]
@property(nonatomic, assign, readonly) NSInteger firstVisibleIndex;

/// index of last currently visible view controller [calculated]
Expand All @@ -121,7 +123,7 @@ enum {
@property(nonatomic, retain) UIPanGestureRecognizer *panRecognizer;

/// toggle full menu / small menu
@property(nonatomic, assign, getter=isShowingFullMenu, readonly) BOOL showingFullMenu;
//@property(nonatomic, assign, getter=isShowingFullMenu, readonly) BOOL showingFullMenu;

/// left inset thats always visible. Defaults to 60.
@property(nonatomic, assign) NSUInteger leftInset;
Expand Down
Loading

0 comments on commit f637184

Please sign in to comment.