Merge pull request #113 from aryaxt/Develop

Version 1.4.5
This commit is contained in:
Aryan Ghassemi 2015-03-01 19:15:53 -08:00
commit 6a9333e81b
4 changed files with 37 additions and 6 deletions

View File

@ -23,6 +23,7 @@
[SlideNavigationController sharedInstance].rightMenu = rightMenu;
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
[SlideNavigationController sharedInstance].menuRevealAnimationDuration = .18;
// Creating a custom bar button for right menu
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];

View File

@ -80,31 +80,38 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
id <SlideNavigationContorllerAnimator> revealAnimator;
CGFloat animationDuration = 0;
switch (indexPath.row)
{
case 0:
revealAnimator = nil;
animationDuration = .19;
break;
case 1:
revealAnimator = [[SlideNavigationContorllerAnimatorSlide alloc] init];
animationDuration = .19;
break;
case 2:
revealAnimator = [[SlideNavigationContorllerAnimatorFade alloc] init];
animationDuration = .18;
break;
case 3:
revealAnimator = [[SlideNavigationContorllerAnimatorSlideAndFade alloc] initWithMaximumFadeAlpha:.8 fadeColor:[UIColor blackColor] andSlideMovement:100];
animationDuration = .19;
break;
case 4:
revealAnimator = [[SlideNavigationContorllerAnimatorScale alloc] init];
animationDuration = .22;
break;
case 5:
revealAnimator = [[SlideNavigationContorllerAnimatorScaleAndFade alloc] initWithMaximumFadeAlpha:.6 fadeColor:[UIColor blackColor] andMinimumScale:.8];
animationDuration = .22;
break;
default:
@ -112,6 +119,7 @@
}
[[SlideNavigationController sharedInstance] closeMenuWithCompletion:^{
[SlideNavigationController sharedInstance].menuRevealAnimationDuration = animationDuration;
[SlideNavigationController sharedInstance].menuRevealAnimator = revealAnimator;
}];
}

View File

@ -58,6 +58,8 @@ extern NSString *const SlideNavigationControllerDidReveal;
@property (nonatomic, assign) CGFloat portraitSlideOffset;
@property (nonatomic, assign) CGFloat landscapeSlideOffset;
@property (nonatomic, assign) CGFloat panGestureSideOffset;
@property (nonatomic, assign) CGFloat menuRevealAnimationDuration;
@property (nonatomic, assign) UIViewAnimationOptions menuRevealAnimationOption;
@property (nonatomic, strong) id <SlideNavigationContorllerAnimator> menuRevealAnimator;
+ (SlideNavigationController *)sharedInstance;

View File

@ -48,6 +48,7 @@ NSString * const SlideNavigationControllerDidClose = @"SlideNavigationController
NSString *const SlideNavigationControllerDidReveal = @"SlideNavigationControllerDidReveal";
#define MENU_SLIDE_ANIMATION_DURATION .3
#define MENU_SLIDE_ANIMATION_OPTION UIViewAnimationOptionCurveEaseOut
#define MENU_QUICK_SLIDE_ANIMATION_DURATION .18
#define MENU_IMAGE @"menu-button"
#define MENU_SHADOW_RADIUS 10
@ -101,6 +102,16 @@ static SlideNavigationController *singletonInstance;
return self;
}
- (id)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass
{
if (self = [super initWithNavigationBarClass:navigationBarClass toolbarClass:toolbarClass])
{
[self setup];
}
return self;
}
- (void)setup
{
if (singletonInstance)
@ -108,6 +119,8 @@ static SlideNavigationController *singletonInstance;
singletonInstance = self;
self.menuRevealAnimationDuration = MENU_SLIDE_ANIMATION_DURATION;
self.menuRevealAnimationOption = MENU_SLIDE_ANIMATION_OPTION;
self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
self.panGestureSideOffset = 0;
@ -232,9 +245,9 @@ static SlideNavigationController *singletonInstance;
{
if (slideOutAnimation)
{
[UIView animateWithDuration:(slideOutAnimation) ? MENU_SLIDE_ANIMATION_DURATION : 0
[UIView animateWithDuration:(slideOutAnimation) ? self.menuRevealAnimationDuration : 0
delay:0
options:UIViewAnimationOptionCurveEaseOut
options:self.menuRevealAnimationOption
animations:^{
CGFloat width = self.horizontalSize;
CGFloat moveLocation = (self.horizontalLocation> 0) ? width : -1*width;
@ -287,12 +300,12 @@ static SlideNavigationController *singletonInstance;
- (void)closeMenuWithCompletion:(void (^)())completion
{
[self closeMenuWithDuration:MENU_SLIDE_ANIMATION_DURATION andCompletion:completion];
[self closeMenuWithDuration:self.menuRevealAnimationDuration andCompletion:completion];
}
- (void)openMenu:(Menu)menu withCompletion:(void (^)())completion
{
[self openMenu:menu withDuration:MENU_SLIDE_ANIMATION_DURATION andCompletion:completion];
[self openMenu:menu withDuration:self.menuRevealAnimationDuration andCompletion:completion];
}
- (void)toggleLeftMenu
@ -467,7 +480,7 @@ static SlideNavigationController *singletonInstance;
[UIView animateWithDuration:duration
delay:0
options:UIViewAnimationOptionCurveEaseOut
options:self.menuRevealAnimationOption
animations:^{
CGRect rect = self.view.frame;
CGFloat width = self.horizontalSize;
@ -490,7 +503,7 @@ static SlideNavigationController *singletonInstance;
[UIView animateWithDuration:duration
delay:0
options:UIViewAnimationOptionCurveEaseOut
options:self.menuRevealAnimationOption
animations:^{
CGRect rect = self.view.frame;
rect.origin.x = 0;
@ -647,6 +660,13 @@ static SlideNavigationController *singletonInstance;
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:userInfo];
}
#pragma mark - UIGestureRecognizerDelegate Methods -
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
#pragma mark - UINavigationControllerDelegate Methods -
- (void)navigationController:(UINavigationController *)navigationController