diff --git a/SlideMenu.xcodeproj/project.pbxproj b/SlideMenu.xcodeproj/project.pbxproj index 8617671..5b91972 100755 --- a/SlideMenu.xcodeproj/project.pbxproj +++ b/SlideMenu.xcodeproj/project.pbxproj @@ -30,12 +30,17 @@ 15C9AC1A1895A80E006E6F27 /* SlideNavigationContorllerAnimatorScale.m in Sources */ = {isa = PBXBuildFile; fileRef = 15C9AC191895A80E006E6F27 /* SlideNavigationContorllerAnimatorScale.m */; }; 15C9AC1D1895A81D006E6F27 /* SlideNavigationContorllerAnimatorScaleAndFade.m in Sources */ = {isa = PBXBuildFile; fileRef = 15C9AC1C1895A81D006E6F27 /* SlideNavigationContorllerAnimatorScaleAndFade.m */; }; 15CBD67C172A15F900F0C53E /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD677172A15F900F0C53E /* HomeViewController.m */; }; - 15CBD67D172A15F900F0C53E /* MenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD679172A15F900F0C53E /* MenuViewController.m */; }; + 15CBD67D172A15F900F0C53E /* LeftMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD679172A15F900F0C53E /* LeftMenuViewController.m */; }; 15CBD67E172A15F900F0C53E /* ProfileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD67B172A15F900F0C53E /* ProfileViewController.m */; }; 15CBD689172A22B700F0C53E /* ProfileDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15CBD688172A22B700F0C53E /* ProfileDetailViewController.m */; }; 15CBD699172A57F100F0C53E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15CBD698172A57F100F0C53E /* QuartzCore.framework */; }; 15CBD6BE172BBB3600F0C53E /* menu-button@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 15CBD6BD172BBB3600F0C53E /* menu-button@2x.png */; }; 15CBD6C0172BBB7100F0C53E /* menu-button.png in Resources */ = {isa = PBXBuildFile; fileRef = 15CBD6BF172BBB7100F0C53E /* menu-button.png */; }; + 15E7D318190C24E3002EAE3F /* RightMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 15E7D317190C24E3002EAE3F /* RightMenuViewController.m */; }; + 15E7D31B190C289E002EAE3F /* animation.png in Resources */ = {isa = PBXBuildFile; fileRef = 15E7D31A190C289E002EAE3F /* animation.png */; }; + 15E7D31F190C33A5002EAE3F /* leftMenu.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 15E7D31D190C33A5002EAE3F /* leftMenu.jpg */; }; + 15E7D321190C3B75002EAE3F /* rightMenu.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 15E7D320190C3B75002EAE3F /* rightMenu.jpg */; }; + 15E7D327190C3DAE002EAE3F /* gear.png in Resources */ = {isa = PBXBuildFile; fileRef = 15E7D326190C3DAE002EAE3F /* gear.png */; }; 997929E2187336AA00716C77 /* FriendsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 997929E1187336AA00716C77 /* FriendsViewController.m */; }; /* End PBXBuildFile section */ @@ -86,8 +91,8 @@ 15C9AC1E1895A832006E6F27 /* SlideNavigationContorllerAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlideNavigationContorllerAnimator.h; sourceTree = ""; }; 15CBD676172A15F900F0C53E /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = ""; }; 15CBD677172A15F900F0C53E /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = ""; }; - 15CBD678172A15F900F0C53E /* MenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuViewController.h; sourceTree = ""; }; - 15CBD679172A15F900F0C53E /* MenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuViewController.m; sourceTree = ""; }; + 15CBD678172A15F900F0C53E /* LeftMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeftMenuViewController.h; sourceTree = ""; }; + 15CBD679172A15F900F0C53E /* LeftMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeftMenuViewController.m; sourceTree = ""; }; 15CBD67A172A15F900F0C53E /* ProfileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileViewController.h; sourceTree = ""; }; 15CBD67B172A15F900F0C53E /* ProfileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProfileViewController.m; sourceTree = ""; }; 15CBD687172A22B600F0C53E /* ProfileDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileDetailViewController.h; sourceTree = ""; }; @@ -95,6 +100,12 @@ 15CBD698172A57F100F0C53E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 15CBD6BD172BBB3600F0C53E /* menu-button@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu-button@2x.png"; sourceTree = ""; }; 15CBD6BF172BBB7100F0C53E /* menu-button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu-button.png"; sourceTree = ""; }; + 15E7D316190C24E3002EAE3F /* RightMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RightMenuViewController.h; sourceTree = ""; }; + 15E7D317190C24E3002EAE3F /* RightMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RightMenuViewController.m; sourceTree = ""; }; + 15E7D31A190C289E002EAE3F /* animation.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = animation.png; sourceTree = ""; }; + 15E7D31D190C33A5002EAE3F /* leftMenu.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = leftMenu.jpg; sourceTree = ""; }; + 15E7D320190C3B75002EAE3F /* rightMenu.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = rightMenu.jpg; sourceTree = ""; }; + 15E7D326190C3DAE002EAE3F /* gear.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gear.png; sourceTree = ""; }; 997929E0187336AA00716C77 /* FriendsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FriendsViewController.h; sourceTree = ""; }; 997929E1187336AA00716C77 /* FriendsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FriendsViewController.m; sourceTree = ""; }; /* End PBXFileReference section */ @@ -158,6 +169,7 @@ 15371EE81728E3B400A508F4 /* SlideMenu */ = { isa = PBXGroup; children = ( + 15E7D319190C2894002EAE3F /* Images */, 15CBD675172A15F900F0C53E /* Helper Classes */, 15371F241728E43600A508F4 /* Source */, 15371EF11728E3B400A508F4 /* AppDelegate.h */, @@ -234,8 +246,10 @@ 15CBD675172A15F900F0C53E /* Helper Classes */ = { isa = PBXGroup; children = ( - 15CBD678172A15F900F0C53E /* MenuViewController.h */, - 15CBD679172A15F900F0C53E /* MenuViewController.m */, + 15CBD678172A15F900F0C53E /* LeftMenuViewController.h */, + 15CBD679172A15F900F0C53E /* LeftMenuViewController.m */, + 15E7D316190C24E3002EAE3F /* RightMenuViewController.h */, + 15E7D317190C24E3002EAE3F /* RightMenuViewController.m */, 15CBD676172A15F900F0C53E /* HomeViewController.h */, 15CBD677172A15F900F0C53E /* HomeViewController.m */, 997929E0187336AA00716C77 /* FriendsViewController.h */, @@ -257,6 +271,17 @@ path = Assets; sourceTree = ""; }; + 15E7D319190C2894002EAE3F /* Images */ = { + isa = PBXGroup; + children = ( + 15E7D326190C3DAE002EAE3F /* gear.png */, + 15E7D320190C3B75002EAE3F /* rightMenu.jpg */, + 15E7D31D190C33A5002EAE3F /* leftMenu.jpg */, + 15E7D31A190C289E002EAE3F /* animation.png */, + ); + path = Images; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -329,9 +354,13 @@ buildActionMask = 2147483647; files = ( 15371EED1728E3B400A508F4 /* InfoPlist.strings in Resources */, + 15E7D321190C3B75002EAE3F /* rightMenu.jpg in Resources */, + 15E7D327190C3DAE002EAE3F /* gear.png in Resources */, 15371EF51728E3B400A508F4 /* Default.png in Resources */, 15371EF71728E3B400A508F4 /* Default@2x.png in Resources */, + 15E7D31F190C33A5002EAE3F /* leftMenu.jpg in Resources */, 15371EF91728E3B400A508F4 /* Default-568h@2x.png in Resources */, + 15E7D31B190C289E002EAE3F /* animation.png in Resources */, 15371EFC1728E3B400A508F4 /* MainStoryboard_iPhone.storyboard in Resources */, 15371EFF1728E3B400A508F4 /* MainStoryboard_iPad.storyboard in Resources */, 15CBD6BE172BBB3600F0C53E /* menu-button@2x.png in Resources */, @@ -370,6 +399,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 15E7D318190C24E3002EAE3F /* RightMenuViewController.m in Sources */, 15C9AC1D1895A81D006E6F27 /* SlideNavigationContorllerAnimatorScaleAndFade.m in Sources */, 15C9AC171895A7E7006E6F27 /* SlideNavigationContorllerAnimatorSlideAndFade.m in Sources */, 15371EEF1728E3B400A508F4 /* main.m in Sources */, @@ -379,7 +409,7 @@ 15C9AC111895A7BF006E6F27 /* SlideNavigationContorllerAnimatorSlide.m in Sources */, 15CBD67C172A15F900F0C53E /* HomeViewController.m in Sources */, 997929E2187336AA00716C77 /* FriendsViewController.m in Sources */, - 15CBD67D172A15F900F0C53E /* MenuViewController.m in Sources */, + 15CBD67D172A15F900F0C53E /* LeftMenuViewController.m in Sources */, 15C9AC1A1895A80E006E6F27 /* SlideNavigationContorllerAnimatorScale.m in Sources */, 15CBD67E172A15F900F0C53E /* ProfileViewController.m in Sources */, 15CBD689172A22B700F0C53E /* ProfileDetailViewController.m in Sources */, diff --git a/SlideMenu/AppDelegate.h b/SlideMenu/AppDelegate.h index 70b624f..a8b3f5a 100644 --- a/SlideMenu/AppDelegate.h +++ b/SlideMenu/AppDelegate.h @@ -8,7 +8,8 @@ #import #import "SlideNavigationController.h" -#import "MenuViewController.h" +#import "LeftMenuViewController.h" +#import "RightMenuViewController.h" @interface AppDelegate : UIResponder diff --git a/SlideMenu/AppDelegate.m b/SlideMenu/AppDelegate.m index b233a8a..c49d7b0 100644 --- a/SlideMenu/AppDelegate.m +++ b/SlideMenu/AppDelegate.m @@ -15,20 +15,18 @@ UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil]; - MenuViewController *rightMenu = (MenuViewController*)[mainStoryboard - instantiateViewControllerWithIdentifier: @"MenuViewController"]; - rightMenu.cellIdentifier = @"rightMenuCell"; + LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard + instantiateViewControllerWithIdentifier: @"LeftMenuViewController"]; - MenuViewController *leftMenu = (MenuViewController*)[mainStoryboard - instantiateViewControllerWithIdentifier: @"MenuViewController"]; - leftMenu.cellIdentifier = @"leftMenuCell"; + RightMenuViewController *rightMenu = (RightMenuViewController*)[mainStoryboard + instantiateViewControllerWithIdentifier: @"RightMenuViewController"]; [SlideNavigationController sharedInstance].rightMenu = rightMenu; [SlideNavigationController sharedInstance].leftMenu = leftMenu; // Creating a custom bar button for right menu UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)]; - [button setImage:[UIImage imageNamed:@"menu-button"] forState:UIControlStateNormal]; + [button setImage:[UIImage imageNamed:@"gear"] forState:UIControlStateNormal]; [button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleRightMenu) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; [SlideNavigationController sharedInstance].rightBarButtonItem = rightBarButtonItem; diff --git a/SlideMenu/Helper Classes/HomeViewController.h b/SlideMenu/Helper Classes/HomeViewController.h index c0a1ef1..a20df36 100755 --- a/SlideMenu/Helper Classes/HomeViewController.h +++ b/SlideMenu/Helper Classes/HomeViewController.h @@ -11,6 +11,21 @@ @interface HomeViewController : UIViewController +@property (nonatomic, strong) IBOutlet UISwitch *limitPanGestureSwitch; +@property (nonatomic, strong) IBOutlet UISwitch *slideOutAnimationSwitch; +@property (nonatomic, strong) IBOutlet UISwitch *shadowSwitch; +@property (nonatomic, strong) IBOutlet UISwitch *panGestureSwitch; +@property (nonatomic, strong) IBOutlet UISegmentedControl *portraitSlideOffsetSegment; +@property (nonatomic, strong) IBOutlet UISegmentedControl *landscapeSlideOffsetSegment; +@property (nonatomic, strong) IBOutlet UIScrollView *scrollView; + - (IBAction)bounceMenu:(id)sender; +- (IBAction)slideOutAnimationSwitchChanged:(id)sender; +- (IBAction)limitPanGestureSwitchChanged:(id)sender; +- (IBAction)changeAnimationSelected:(id)sender; +- (IBAction)shadowSwitchSelected:(id)sender; +- (IBAction)enablePanGestureSelected:(id)sender; +- (IBAction)portraitSlideOffsetChanged:(id)sender; +- (IBAction)landscapeSlideOffsetChanged:(id)sender; @end diff --git a/SlideMenu/Helper Classes/HomeViewController.m b/SlideMenu/Helper Classes/HomeViewController.m index 97fbd71..f0d54fe 100755 --- a/SlideMenu/Helper Classes/HomeViewController.m +++ b/SlideMenu/Helper Classes/HomeViewController.m @@ -7,12 +7,21 @@ // #import "HomeViewController.h" +#import "LeftMenuViewController.h" @implementation HomeViewController - (void)viewDidLoad { [super viewDidLoad]; + + self.scrollView.contentSize = CGSizeMake(self.view.frame.size.width, 503); + self.portraitSlideOffsetSegment.selectedSegmentIndex = [self indexFromPixels:[SlideNavigationController sharedInstance].portraitSlideOffset]; + self.landscapeSlideOffsetSegment.selectedSegmentIndex = [self indexFromPixels:[SlideNavigationController sharedInstance].landscapeSlideOffset]; + self.panGestureSwitch.on = [SlideNavigationController sharedInstance].enableSwipeGesture; + self.shadowSwitch.on = [SlideNavigationController sharedInstance].enableShadow; + self.limitPanGestureSwitch.on = ([SlideNavigationController sharedInstance].panGestureSideOffset == 0) ? NO : YES; + self.slideOutAnimationSwitch.on = ((LeftMenuViewController *)[SlideNavigationController sharedInstance].leftMenu).slideOutAnimationEnabled; } #pragma mark - SlideNavigationController Methods - @@ -38,4 +47,69 @@ menu = (menu == MenuLeft) ? MenuRight : MenuLeft; } +- (IBAction)slideOutAnimationSwitchChanged:(UISwitch *)sender +{ + ((LeftMenuViewController *)[SlideNavigationController sharedInstance].leftMenu).slideOutAnimationEnabled = sender.isOn; +} + +- (IBAction)limitPanGestureSwitchChanged:(UISwitch *)sender +{ + [SlideNavigationController sharedInstance].panGestureSideOffset = (sender.isOn) ? 50 : 0; +} + +- (IBAction)changeAnimationSelected:(id)sender +{ + [[SlideNavigationController sharedInstance] openMenu:MenuRight withCompletion:nil]; +} + +- (IBAction)shadowSwitchSelected:(UISwitch *)sender +{ + [SlideNavigationController sharedInstance].enableShadow = sender.isOn; +} + +- (IBAction)enablePanGestureSelected:(UISwitch *)sender +{ + [SlideNavigationController sharedInstance].enableSwipeGesture = sender.isOn; +} + +- (IBAction)portraitSlideOffsetChanged:(UISegmentedControl *)sender +{ + [SlideNavigationController sharedInstance].portraitSlideOffset = [self pixelsFromIndex:sender.selectedSegmentIndex]; +} + +- (IBAction)landscapeSlideOffsetChanged:(UISegmentedControl *)sender +{ + [SlideNavigationController sharedInstance].landscapeSlideOffset = [self pixelsFromIndex:sender.selectedSegmentIndex]; +} + +#pragma mark - Helpers - + +- (NSInteger)indexFromPixels:(NSInteger)pixels +{ + if (pixels == 60) + return 0; + else if (pixels == 120) + return 1; + else + return 2; +} + +- (NSInteger)pixelsFromIndex:(NSInteger)index +{ + switch (index) + { + case 0: + return 60; + + case 1: + return 120; + + case 2: + return 200; + + default: + return 0; + } +} + @end diff --git a/SlideMenu/Helper Classes/LeftMenuViewController.h b/SlideMenu/Helper Classes/LeftMenuViewController.h new file mode 100755 index 0000000..4d4ad20 --- /dev/null +++ b/SlideMenu/Helper Classes/LeftMenuViewController.h @@ -0,0 +1,17 @@ +// +// MenuViewController.h +// SlideMenu +// +// Created by Aryan Gh on 4/24/13. +// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. +// + +#import +#import "SlideNavigationController.h" + +@interface LeftMenuViewController : UIViewController + +@property (nonatomic, strong) IBOutlet UITableView *tableView; +@property (nonatomic, assign) BOOL slideOutAnimationEnabled; + +@end diff --git a/SlideMenu/Helper Classes/LeftMenuViewController.m b/SlideMenu/Helper Classes/LeftMenuViewController.m new file mode 100755 index 0000000..ec804cc --- /dev/null +++ b/SlideMenu/Helper Classes/LeftMenuViewController.m @@ -0,0 +1,120 @@ +// +// MenuViewController.m +// SlideMenu +// +// Created by Aryan Gh on 4/24/13. +// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. +// + +#import "LeftMenuViewController.h" +#import "SlideNavigationContorllerAnimatorFade.h" +#import "SlideNavigationContorllerAnimatorSlide.h" +#import "SlideNavigationContorllerAnimatorScale.h" +#import "SlideNavigationContorllerAnimatorScaleAndFade.h" +#import "SlideNavigationContorllerAnimatorSlideAndFade.h" + +@implementation LeftMenuViewController + +#pragma mark - UIViewController Methods - + +- (id)initWithCoder:(NSCoder *)aDecoder +{ + self.slideOutAnimationEnabled = YES; + + return [super initWithCoder:aDecoder]; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.tableView.separatorColor = [UIColor lightGrayColor]; + + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"leftMenu.jpg"]]; + self.tableView.backgroundView = imageView; + + self.view.layer.borderWidth = .6; + self.view.layer.borderColor = [UIColor lightGrayColor].CGColor; +} + +#pragma mark - UITableView Delegate & Datasrouce - + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 4; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section +{ + UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 20)]; + view.backgroundColor = [UIColor clearColor]; + return view; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 20; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"leftMenuCell"]; + + switch (indexPath.row) + { + case 0: + cell.textLabel.text = @"Home"; + break; + + case 1: + cell.textLabel.text = @"Profile"; + break; + + case 2: + cell.textLabel.text = @"Friends"; + break; + + case 3: + cell.textLabel.text = @"Sign Out"; + break; + } + + cell.backgroundColor = [UIColor clearColor]; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" + bundle: nil]; + + UIViewController *vc ; + + switch (indexPath.row) + { + case 0: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"HomeViewController"]; + break; + + case 1: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"ProfileViewController"]; + break; + + case 2: + vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"FriendsViewController"]; + break; + + case 3: + [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; + [[SlideNavigationController sharedInstance] popToRootViewControllerAnimated:YES]; + return; + break; + } + + [[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc + withSlideOutAnimation:self.slideOutAnimationEnabled + andCompletion:nil]; +} + +@end diff --git a/SlideMenu/Helper Classes/MenuViewController.h b/SlideMenu/Helper Classes/MenuViewController.h deleted file mode 100755 index 0d2e7aa..0000000 --- a/SlideMenu/Helper Classes/MenuViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// MenuViewController.h -// SlideMenu -// -// Created by Aryan Gh on 4/24/13. -// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. -// - -#import -#import "SlideNavigationController.h" - -@interface MenuViewController : UIViewController - -@property (nonatomic, strong) NSString *cellIdentifier; - -@end diff --git a/SlideMenu/Helper Classes/MenuViewController.m b/SlideMenu/Helper Classes/MenuViewController.m deleted file mode 100755 index dc9f75b..0000000 --- a/SlideMenu/Helper Classes/MenuViewController.m +++ /dev/null @@ -1,165 +0,0 @@ -// -// MenuViewController.m -// SlideMenu -// -// Created by Aryan Gh on 4/24/13. -// Copyright (c) 2013 Aryan Ghassemi. All rights reserved. -// - -#import "MenuViewController.h" -#import "SlideNavigationContorllerAnimatorFade.h" -#import "SlideNavigationContorllerAnimatorSlide.h" -#import "SlideNavigationContorllerAnimatorScale.h" -#import "SlideNavigationContorllerAnimatorScaleAndFade.h" -#import "SlideNavigationContorllerAnimatorSlideAndFade.h" - -@implementation MenuViewController -@synthesize cellIdentifier; - -#pragma mark - UITableView Delegate & Datasrouce - - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return 2; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return (section == 0) ? 4 : 6; -} - -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section -{ - return (section == 0) ? @"Navigation" : @"Menu Animation"; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier]; - - if (indexPath.section == 0) - { - switch (indexPath.row) - { - case 0: - cell.textLabel.text = @"Home"; - break; - - case 1: - cell.textLabel.text = @"Profile"; - break; - - case 2: - cell.textLabel.text = @"Friends"; - break; - - case 3: - cell.textLabel.text = @"Sign Out"; - break; - } - } - else - { - switch (indexPath.row) - { - case 0: - cell.textLabel.text = @"No Animation"; - break; - - case 1: - cell.textLabel.text = @"Slide Animation"; - break; - - case 2: - cell.textLabel.text = @"Fade Animation"; - break; - - case 3: - cell.textLabel.text = @"Slide And Fade Animation"; - break; - - case 4: - cell.textLabel.text = @"Scale Animation"; - break; - - case 5: - cell.textLabel.text = @"Scale And Fade Animation"; - break; - } - } - - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" - bundle: nil]; - - if (indexPath.section == 0) - { - UIViewController *vc ; - - switch (indexPath.row) - { - case 0: - vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"HomeViewController"]; - break; - - case 1: - vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"ProfileViewController"]; - break; - - case 2: - vc = [mainStoryboard instantiateViewControllerWithIdentifier: @"FriendsViewController"]; - break; - - case 3: - [[SlideNavigationController sharedInstance] popToRootViewControllerAnimated:YES]; - return; - break; - } - - [[SlideNavigationController sharedInstance] popToRootAndSwitchToViewController:vc withCompletion:nil]; - } - else - { - id revealAnimator; - - switch (indexPath.row) - { - case 0: - revealAnimator = nil; - break; - - case 1: - revealAnimator = [[SlideNavigationContorllerAnimatorSlide alloc] init]; - break; - - case 2: - revealAnimator = [[SlideNavigationContorllerAnimatorFade alloc] init]; - break; - - case 3: - revealAnimator = [[SlideNavigationContorllerAnimatorSlideAndFade alloc] initWithMaximumFadeAlpha:.7 fadeColor:[UIColor purpleColor] andSlideMovement:100]; - break; - - case 4: - revealAnimator = [[SlideNavigationContorllerAnimatorScale alloc] init]; - break; - - case 5: - revealAnimator = [[SlideNavigationContorllerAnimatorScaleAndFade alloc] initWithMaximumFadeAlpha:.6 fadeColor:[UIColor blueColor] andMinimumScale:.7]; - break; - - default: - return; - } - - [[SlideNavigationController sharedInstance] closeMenuWithCompletion:^{ - [SlideNavigationController sharedInstance].menuRevealAnimator = revealAnimator; - }]; - } -} - -@end diff --git a/SlideMenu/Helper Classes/RightMenuViewController.h b/SlideMenu/Helper Classes/RightMenuViewController.h new file mode 100644 index 0000000..c049a83 --- /dev/null +++ b/SlideMenu/Helper Classes/RightMenuViewController.h @@ -0,0 +1,21 @@ +// +// RightMenuViewController.h +// SlideMenu +// +// Created by Aryan Gh on 4/26/14. +// Copyright (c) 2014 Aryan Ghassemi. All rights reserved. +// + +#import +#import "SlideNavigationContorllerAnimator.h" +#import "SlideNavigationContorllerAnimatorFade.h" +#import "SlideNavigationContorllerAnimatorSlide.h" +#import "SlideNavigationContorllerAnimatorScale.h" +#import "SlideNavigationContorllerAnimatorScaleAndFade.h" +#import "SlideNavigationContorllerAnimatorSlideAndFade.h" + +@interface RightMenuViewController : UIViewController + +@property (nonatomic, strong) IBOutlet UITableView *tableView; + +@end diff --git a/SlideMenu/Helper Classes/RightMenuViewController.m b/SlideMenu/Helper Classes/RightMenuViewController.m new file mode 100644 index 0000000..3cb8daa --- /dev/null +++ b/SlideMenu/Helper Classes/RightMenuViewController.m @@ -0,0 +1,122 @@ +// +// RightMenuViewController.m +// SlideMenu +// +// Created by Aryan Gh on 4/26/14. +// Copyright (c) 2014 Aryan Ghassemi. All rights reserved. +// + +#import "RightMenuViewController.h" + +@implementation RightMenuViewController + +#pragma mark - UIViewController Methods - + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.tableView.separatorColor = [UIColor lightGrayColor]; + + UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"rightMenu.jpg"]]; + self.tableView.backgroundView = imageView; + + self.view.layer.borderWidth = .6; + self.view.layer.borderColor = [UIColor lightGrayColor].CGColor; +} + +#pragma mark - UITableView Delegate & Datasrouce - + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 6; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section +{ + UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 20)]; + view.backgroundColor = [UIColor clearColor]; + return view; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 20; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"rightMenuCell"]; + + switch (indexPath.row) + { + case 0: + cell.textLabel.text = @"None"; + break; + + case 1: + cell.textLabel.text = @"Slide"; + break; + + case 2: + cell.textLabel.text = @"Fade"; + break; + + case 3: + cell.textLabel.text = @"Slide And Fade"; + break; + + case 4: + cell.textLabel.text = @"Scale"; + break; + + case 5: + cell.textLabel.text = @"Scale And Fade"; + break; + } + + cell.backgroundColor = [UIColor clearColor]; + + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + id revealAnimator; + + switch (indexPath.row) + { + case 0: + revealAnimator = nil; + break; + + case 1: + revealAnimator = [[SlideNavigationContorllerAnimatorSlide alloc] init]; + break; + + case 2: + revealAnimator = [[SlideNavigationContorllerAnimatorFade alloc] init]; + break; + + case 3: + revealAnimator = [[SlideNavigationContorllerAnimatorSlideAndFade alloc] initWithMaximumFadeAlpha:.8 fadeColor:[UIColor blackColor] andSlideMovement:100]; + break; + + case 4: + revealAnimator = [[SlideNavigationContorllerAnimatorScale alloc] init]; + break; + + case 5: + revealAnimator = [[SlideNavigationContorllerAnimatorScaleAndFade alloc] initWithMaximumFadeAlpha:.6 fadeColor:[UIColor blackColor] andMinimumScale:.8]; + break; + + default: + return; + } + + [[SlideNavigationController sharedInstance] closeMenuWithCompletion:^{ + [SlideNavigationController sharedInstance].menuRevealAnimator = revealAnimator; + }]; +} + +@end diff --git a/SlideMenu/Images/animation.png b/SlideMenu/Images/animation.png new file mode 100644 index 0000000..93ef274 Binary files /dev/null and b/SlideMenu/Images/animation.png differ diff --git a/SlideMenu/Images/gear.png b/SlideMenu/Images/gear.png new file mode 100644 index 0000000..a7f1019 Binary files /dev/null and b/SlideMenu/Images/gear.png differ diff --git a/SlideMenu/Images/leftMenu.jpg b/SlideMenu/Images/leftMenu.jpg new file mode 100644 index 0000000..2528469 Binary files /dev/null and b/SlideMenu/Images/leftMenu.jpg differ diff --git a/SlideMenu/Images/rightMenu.jpg b/SlideMenu/Images/rightMenu.jpg new file mode 100644 index 0000000..69381c6 Binary files /dev/null and b/SlideMenu/Images/rightMenu.jpg differ diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index 45faab0..a299ed4 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -298,6 +298,8 @@ static SlideNavigationController *singletonInstance; - (void)setEnableShadow:(BOOL)enable { + _enableShadow = enable; + if (enable) { self.view.layer.shadowColor = [UIColor darkGrayColor].CGColor; diff --git a/SlideMenu/en.lproj/MainStoryboard_iPad.storyboard b/SlideMenu/en.lproj/MainStoryboard_iPad.storyboard index 3f61cf4..c4f79d6 100644 --- a/SlideMenu/en.lproj/MainStoryboard_iPad.storyboard +++ b/SlideMenu/en.lproj/MainStoryboard_iPad.storyboard @@ -1,59 +1,41 @@ - + - - + + - + - - + + - + - - + + - + - + - - - - - - - - - - - - @@ -62,97 +44,213 @@ - - + + + + + - + - + - + - - + + - + - + - + - + - - + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + - + - + - + - - + + - + - - - + + + @@ -163,116 +261,116 @@ - + - + - + - - + + - + - + - + - - + - + - + - + - + - - + + - + - - + - - + + - + - + - + - - + + - - + + - - + + - + - - + - - + + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard b/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard old mode 100755 new mode 100644 index c0941cc..e8d5d55 --- a/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard +++ b/SlideMenu/en.lproj/MainStoryboard_iPhone.storyboard @@ -5,40 +5,22 @@ - + - + - + - - - - - - - - - - - - - + @@ -47,9 +29,9 @@ @@ -65,10 +47,13 @@ + + + - + @@ -93,37 +78,150 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -219,8 +317,8 @@ - - + + @@ -236,17 +334,17 @@ - + - + - + @@ -262,7 +360,7 @@ - + @@ -272,15 +370,16 @@ + - + - + @@ -296,6 +395,7 @@ + @@ -316,6 +416,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS-Slide-Menu.podspec b/iOS-Slide-Menu.podspec index 5409906..3cdd765 100644 --- a/iOS-Slide-Menu.podspec +++ b/iOS-Slide-Menu.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'iOS-Slide-Menu' - s.version = '1.3.0' + s.version = '1.4.0' s.summary = 'A Slide Menu for iOS' s.homepage = 'https://github.com/aryaxt/iOS-Slide-Menu' s.license = { @@ -8,7 +8,7 @@ Pod::Spec.new do |s| :file => 'License.txt' } s.author = {'Aryan Gh' => 'https://github.com/aryaxt/iOS-Slide-Menu'} - s.source = {:git => 'https://github.com/aryaxt/iOS-Slide-Menu.git', :tag => '1.3.0'} + s.source = {:git => 'https://github.com/aryaxt/iOS-Slide-Menu.git', :tag => '1.4.0'} s.platform = :ios, '6.0' s.source_files = 'SlideMenu/Source/*.{h,m}', 'SlideMenu/Source/Animations/*.{h,m}', 'SlideMenu/Source/Assets/*.{png}' s.resources = ['SlideMenu/Source/Assets/**/*']