diff --git a/SlideMenu.xcodeproj/project.pbxproj b/SlideMenu.xcodeproj/project.pbxproj index 105ebb4..20fcb7a 100644 --- a/SlideMenu.xcodeproj/project.pbxproj +++ b/SlideMenu.xcodeproj/project.pbxproj @@ -30,7 +30,6 @@ 15CBD684172A20DA00F0C53E /* left-menu-button.png in Resources */ = {isa = PBXBuildFile; fileRef = 15CBD682172A20DA00F0C53E /* left-menu-button.png */; }; 15CBD685172A20DA00F0C53E /* right-menu-button.png in Resources */ = {isa = PBXBuildFile; fileRef = 15CBD683172A20DA00F0C53E /* right-menu-button.png */; }; 15CBD689172A22B700F0C53E /* ProfileDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD688172A22B700F0C53E /* ProfileDetailViewController.m */; }; - 15CBD697172A579700F0C53E /* UINavigationBar+RoundedCorners.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD696172A579700F0C53E /* UINavigationBar+RoundedCorners.m */; }; 15CBD699172A57F100F0C53E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CBD698172A57F100F0C53E /* QuartzCore.framework */; }; /* End PBXBuildFile section */ @@ -78,8 +77,6 @@ 15CBD683172A20DA00F0C53E /* right-menu-button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "right-menu-button.png"; sourceTree = ""; }; 15CBD687172A22B600F0C53E /* ProfileDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileDetailViewController.h; sourceTree = ""; }; 15CBD688172A22B700F0C53E /* ProfileDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProfileDetailViewController.m; sourceTree = ""; }; - 15CBD695172A579700F0C53E /* UINavigationBar+RoundedCorners.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UINavigationBar+RoundedCorners.h"; sourceTree = ""; }; - 15CBD696172A579700F0C53E /* UINavigationBar+RoundedCorners.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UINavigationBar+RoundedCorners.m"; sourceTree = ""; }; 15CBD698172A57F100F0C53E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -192,8 +189,6 @@ 15CBD681172A209500F0C53E /* Assets */, 15371F261728E44E00A508F4 /* SlideNavigationController.h */, 15371F271728E44E00A508F4 /* SlideNavigationController.m */, - 15CBD695172A579700F0C53E /* UINavigationBar+RoundedCorners.h */, - 15CBD696172A579700F0C53E /* UINavigationBar+RoundedCorners.m */, ); path = Source; sourceTree = ""; @@ -342,7 +337,6 @@ 15CBD67D172A15F900F0C53E /* MenuViewController.m in Sources */, 15CBD67E172A15F900F0C53E /* ProfileViewController.m in Sources */, 15CBD689172A22B700F0C53E /* ProfileDetailViewController.m in Sources */, - 15CBD697172A579700F0C53E /* UINavigationBar+RoundedCorners.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/SlideMenu/Helper Classes/MenuViewController.m b/SlideMenu/Helper Classes/MenuViewController.m index f6d24dc..513a671 100644 --- a/SlideMenu/Helper Classes/MenuViewController.m +++ b/SlideMenu/Helper Classes/MenuViewController.m @@ -45,8 +45,22 @@ UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil]; - UIViewController *vc = (MenuViewController*)[mainStoryboard - instantiateViewControllerWithIdentifier: @"ProfileViewController"]; + UIViewController *vc ; + + switch (indexPath.row) + { + case 0: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"HomeViewController"]; + break; + + case 1: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"ProfileViewController"]; + break; + + case 2: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"ProfileViewController"]; + break; + } [[SlideNavigationController sharedInstance] switchViewController:vc withCompletion:nil]; } diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index 5916208..f65a563 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -31,20 +31,32 @@ static SlideNavigationController *singletonInstance; - (void)awakeFromNib { - singletonInstance = self; - self.delegate = self; + [self setup]; } - (id)init { if (self = [super init]) { - singletonInstance = self; + [self setup]; } return self; } +- (void)setup +{ + singletonInstance = self; + self.delegate = self; + + self.view.layer.shadowColor = [UIColor darkGrayColor].CGColor; + self.view.layer.shadowRadius = 10; + self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; + self.view.layer.shadowOpacity = 1; + self.view.layer.shouldRasterize = YES; + self.view.layer.rasterizationScale = [UIScreen mainScreen].scale; +} + #pragma mark - Public Methods - - (void)switchViewController:(UIViewController *)viewController withCompletion:(void (^)())completion @@ -58,13 +70,10 @@ static SlideNavigationController *singletonInstance; self.view.frame = rect; } completion:^(BOOL finished) { - [UIView animateWithDuration:MENU_SLIDE_ANIMATION_DURATION animations:^{ - rect.origin.x = 0; - self.view.frame = rect; - - [self popToRootViewControllerAnimated:NO]; - [self pushViewController:viewController animated:NO]; - + [self popToRootViewControllerAnimated:NO]; + [self pushViewController:viewController animated:NO]; + + [self closeMenuWithCompletion:^{ if (completion) completion(); }]; diff --git a/SlideMenu/Source/UINavigationBar+RoundedCorners.h b/SlideMenu/Source/UINavigationBar+RoundedCorners.h deleted file mode 100644 index 6c4e027..0000000 --- a/SlideMenu/Source/UINavigationBar+RoundedCorners.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// UINavigationBar+RoundedCorners.h -// SlideMenu -// -// Created by Aryan Gh on 4/25/13. -// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. -// - -#import -#import - -@interface UINavigationBar (RoundedCorners) - -@end diff --git a/SlideMenu/Source/UINavigationBar+RoundedCorners.m b/SlideMenu/Source/UINavigationBar+RoundedCorners.m deleted file mode 100644 index b35db81..0000000 --- a/SlideMenu/Source/UINavigationBar+RoundedCorners.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// UINavigationBar+RoundedCorners.m -// SlideMenu -// -// Created by Aryan Gh on 4/25/13. -// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. -// - -#import "UINavigationBar+RoundedCorners.h" - -@implementation UINavigationBar (RoundedCorners) - -NSInteger ind = 0; - -- (void)awakeFromNib -{ - CALayer *capa = self.layer; - [capa setShadowColor: [[UIColor blackColor] CGColor]]; - [capa setShadowOpacity:0.85f]; - [capa setShadowOffset: CGSizeMake(0.0f, 1.5f)]; - [capa setShadowRadius:4.0f]; - [capa setShouldRasterize:YES]; - [capa setRasterizationScale:[UIScreen mainScreen].scale]; - - CGRect bounds = capa.bounds; - bounds.size.height += 10.0f; - UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds - byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) - cornerRadii:CGSizeMake(5.0, 5.0)]; - - CAShapeLayer *maskLayer = [CAShapeLayer layer]; - maskLayer.frame = bounds; - maskLayer.path = maskPath.CGPath; - - [capa addSublayer:maskLayer]; - ind = [self.layer.sublayers indexOfObject:maskLayer]; - capa.mask = maskLayer; -} - -@end diff --git a/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard b/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard index 343bda0..b966980 100644 --- a/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard +++ b/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard @@ -72,9 +72,24 @@ + + + + + + + + + + + + + + +