diff --git a/SlideMenu.xcodeproj/project.pbxproj b/SlideMenu.xcodeproj/project.pbxproj index 5daa3ca..105ebb4 100644 --- a/SlideMenu.xcodeproj/project.pbxproj +++ b/SlideMenu.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ 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 */ /* Begin PBXContainerItemProxy section */ @@ -76,6 +78,9 @@ 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 */ /* Begin PBXFrameworksBuildPhase section */ @@ -83,6 +88,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 15CBD699172A57F100F0C53E /* QuartzCore.framework in Frameworks */, 15371EE31728E3B400A508F4 /* UIKit.framework in Frameworks */, 15371EE51728E3B400A508F4 /* Foundation.framework in Frameworks */, 15371EE71728E3B400A508F4 /* CoreGraphics.framework in Frameworks */, @@ -124,6 +130,7 @@ 15371EE11728E3B400A508F4 /* Frameworks */ = { isa = PBXGroup; children = ( + 15CBD698172A57F100F0C53E /* QuartzCore.framework */, 15371EE21728E3B400A508F4 /* UIKit.framework */, 15371EE41728E3B400A508F4 /* Foundation.framework */, 15371EE61728E3B400A508F4 /* CoreGraphics.framework */, @@ -185,6 +192,8 @@ 15CBD681172A209500F0C53E /* Assets */, 15371F261728E44E00A508F4 /* SlideNavigationController.h */, 15371F271728E44E00A508F4 /* SlideNavigationController.m */, + 15CBD695172A579700F0C53E /* UINavigationBar+RoundedCorners.h */, + 15CBD696172A579700F0C53E /* UINavigationBar+RoundedCorners.m */, ); path = Source; sourceTree = ""; @@ -333,6 +342,7 @@ 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/Source/SlideNavigationController.h b/SlideMenu/Source/SlideNavigationController.h index bb0135d..f52641f 100644 --- a/SlideMenu/Source/SlideNavigationController.h +++ b/SlideMenu/Source/SlideNavigationController.h @@ -7,6 +7,7 @@ // #import +#import @protocol SlideNavigationControllerDelegate @optional @@ -14,6 +15,11 @@ - (BOOL)slideNavigationControllerShouldSisplayLeftMenu; @end +typedef enum{ + SideLeft, + SideRight, +}Side; + @interface SlideNavigationController : UINavigationController @property (nonatomic, strong) UIViewController *righMenu; diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index e1e11b6..bf53017 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -8,9 +8,14 @@ #import "SlideNavigationController.h" +@interface SlideNavigationController() +@property (nonatomic, strong) UITapGestureRecognizer *tapRecognizer; +@end + @implementation SlideNavigationController @synthesize righMenu; @synthesize leftMenu; +@synthesize tapRecognizer; #define MENU_OFFSET 60 #define MENU_SLIDE_ANIMATION_DURATION 0.3 @@ -148,9 +153,6 @@ static SlideNavigationController *singletonInstance; rect.origin.x = (self.isMenuOpen) ? 0 : rect.size.width - MENU_OFFSET; self.view.frame = rect; - } - completion:^(BOOL finished) { - }]; } @@ -165,10 +167,24 @@ static SlideNavigationController *singletonInstance; rect.origin.x = (self.isMenuOpen) ? 0 : (rect.size.width - MENU_OFFSET )* -1; self.view.frame = rect; - } - completion:^(BOOL finished) { - }]; } +- (void)tapDetected:(UITapGestureRecognizer *)tapRecognizer +{ + +} + +#pragma mark - Setter & Getter - + +- (UITapGestureRecognizer *)tapRecognizer +{ + if (tapRecognizer) + { + tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected:)]; + } + + return tapRecognizer; +} + @end diff --git a/SlideMenu/Source/UINavigationBar+RoundedCorners.h b/SlideMenu/Source/UINavigationBar+RoundedCorners.h new file mode 100644 index 0000000..6c4e027 --- /dev/null +++ b/SlideMenu/Source/UINavigationBar+RoundedCorners.h @@ -0,0 +1,14 @@ +// +// 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 new file mode 100644 index 0000000..b35db81 --- /dev/null +++ b/SlideMenu/Source/UINavigationBar+RoundedCorners.m @@ -0,0 +1,40 @@ +// +// 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