Skip to content

Commit

Permalink
Added showNavBarAnimated:
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Mar 24, 2014
1 parent 813f15d commit 359c2ef
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
8 changes: 8 additions & 0 deletions AMScrollingNavbar/AMScrollingCollectionViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
*/
- (void)showNavbar;

/** Navbar slide down
*
* Manually show the navbar
*
* @param animated Animates the navbar scrolling
*/
- (void)showNavBarAnimated:(BOOL)animated;

/** Navbar refresh
*
* Use this method when you manually change the navbar items to re-enable the fadeout
Expand Down
8 changes: 8 additions & 0 deletions AMScrollingNavbar/AMScrollingNavbarTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
*/
- (void)showNavbar;

/** Navbar slide down
*
* Manually show the navbar
*
* @param animated Animates the navbar scrolling
*/
- (void)showNavBarAnimated:(BOOL)animated;

/** Navbar refresh
*
* Use this method when you manually change the navbar items to re-enable the fadeout
Expand Down
10 changes: 8 additions & 2 deletions AMScrollingNavbar/AMScrollingNavbarTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ - (void)calculateConstants
}
}

- (void)showNavbar
- (void)showNavBarAnimated:(BOOL)animated
{
NSTimeInterval interval = animated ? 0.2 : 0;
if (self.scrollableView != nil) {
if (self.isCollapsed) {
CGRect rect;
Expand All @@ -150,7 +151,7 @@ - (void)showNavbar
} else {
self.scrollableView.frame = rect;
}
[UIView animateWithDuration:0.2 animations:^{
[UIView animateWithDuration:interval animations:^{
self.lastContentOffset = 0;
[self scrollWithDelta:-self.compatibilityHeight];
}];
Expand All @@ -160,6 +161,11 @@ - (void)showNavbar
}
}

- (void)showNavbar
{
[self showNavBarAnimated:YES];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
Expand Down
8 changes: 8 additions & 0 deletions AMScrollingNavbar/AMScrollingNavbarViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
*/
- (void)showNavbar;

/** Navbar slide down
*
* Manually show the navbar
*
* @param animated Animates the navbar scrolling
*/
- (void)showNavBarAnimated:(BOOL)animated;

/** Navbar refresh
*
* Use this method when you manually change the navbar items to re-enable the fadeout
Expand Down
10 changes: 8 additions & 2 deletions AMScrollingNavbar/AMScrollingNavbarViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ - (void)calculateConstants
}
}

- (void)showNavbar
- (void)showNavBarAnimated:(BOOL)animated
{
NSTimeInterval interval = animated ? 0.2 : 0;
if (self.scrollableView != nil) {
if (self.isCollapsed) {
CGRect rect;
Expand All @@ -150,7 +151,7 @@ - (void)showNavbar
} else {
self.scrollableView.frame = rect;
}
[UIView animateWithDuration:0.2 animations:^{
[UIView animateWithDuration:interval animations:^{
self.lastContentOffset = 0;
[self scrollWithDelta:-self.compatibilityHeight];
}];
Expand All @@ -160,6 +161,11 @@ - (void)showNavbar
}
}

- (void)showNavbar
{
[self showNavBarAnimated:YES];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
Expand Down
10 changes: 8 additions & 2 deletions AMScrollingNavbar/AMSrcollingCollectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ - (void)calculateConstants
}
}

- (void)showNavbar
- (void)showNavBarAnimated:(BOOL)animated
{
NSTimeInterval interval = animated ? 0.2 : 0;
if (self.scrollableView != nil) {
if (self.isCollapsed) {
CGRect rect;
Expand All @@ -150,7 +151,7 @@ - (void)showNavbar
} else {
self.scrollableView.frame = rect;
}
[UIView animateWithDuration:0.2 animations:^{
[UIView animateWithDuration:interval animations:^{
self.lastContentOffset = 0;
[self scrollWithDelta:-self.compatibilityHeight];
}];
Expand All @@ -160,6 +161,11 @@ - (void)showNavbar
}
}

- (void)showNavbar
{
[self showNavBarAnimated:YES];
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
Expand Down

0 comments on commit 359c2ef

Please sign in to comment.