Permalink
Browse files

Merge pull request #4 from lxcid/master

Tracks the paper fold state and updates accordingly + A bug fix to a bug I introduced.
  • Loading branch information...
2 parents 0e25242 + bfc096f commit a448d9e6552f80f3d4c2f07bb1e01a8b0adb13d6 @honcheng committed Nov 20, 2012
Showing with 11 additions and 3 deletions.
  1. +1 −1 PaperFoldMenuController/PaperFold
  2. +10 −2 PaperFoldMenuController/PaperFoldMenuController.m
@@ -172,8 +172,8 @@ - (id)initWithMenuWidth:(float)menuWidth numberOfFolds:(int)numberOfFolds
return self;
}
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- self = [super initWithNibName:nil bundle:nil];
+- (id)initWithNibName:(NSString *)theNibNameOrNil bundle:(NSBundle *)theNibBundleOrNil {
+ self = [super initWithNibName:theNibNameOrNil bundle:theNibBundleOrNil];
if (self)
{
[self commonInit];
@@ -210,6 +210,7 @@ - (void)viewDidLoad
[self.paperFoldView setLeftFoldContentView:menuTableView foldCount:self.numberOfFolds pullFactor:0.9];
[menuTableView setDelegate:self];
[menuTableView setDataSource:self];
+ menuTableView.scrollsToTop = !(self.paperFoldView.state == PaperFoldStateDefault);
self.menuTableView = menuTableView;
ShadowView *menuTableViewSideShadowView = [[ShadowView alloc] initWithFrame:CGRectMake(_menuTableView.frame.size.width-3,0,3,[self.view bounds].size.height) foldDirection:FoldDirectionHorizontalLeftToRight];
@@ -322,4 +323,11 @@ - (void)showMenu:(BOOL)show animated:(BOOL)animated
}
}
+#pragma mark - PaperFoldViewDelegate methods
+
+- (void)paperFoldView:(id)thePaperFoldView didFoldAutomatically:(BOOL)theAutomated toState:(PaperFoldState)thePaperFoldState {
+ BOOL thePaperFoldViewDidFold = (thePaperFoldState == PaperFoldStateDefault);
+ self.menuTableView.scrollsToTop = !thePaperFoldViewDidFold;
+}
+
@end

0 comments on commit a448d9e

Please sign in to comment.