iOS-Slide-Menu/SlideMenu/Helper Classes/MenuViewController.m

135 lines
2.8 KiB
Objective-C
Executable File

//
// MenuViewController.m
// SlideMenu
//
// Created by Aryan Gh on 4/24/13.
// Copyright (c) 2013 Aryan Ghassemi. All rights reserved.
//
#import "MenuViewController.h"
@implementation MenuViewController
@synthesize cellIdentifier;
#pragma mark - UITableView Delegate & Datasrouce -
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier];
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;
case 4:
cell.textLabel.text = @"No Animation";
break;
case 5:
cell.textLabel.text = @"Slide Animation";
break;
case 6:
cell.textLabel.text = @"Fade Animation";
break;
case 7:
cell.textLabel.text = @"Slide And Fade Animation";
break;
case 8:
cell.textLabel.text = @"Scale Animation";
break;
case 9:
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];
UIViewController *vc ;
MenuRevealAnimation revealAnimation = MenuRevealAnimationNone;
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;
case 4:
revealAnimation = MenuRevealAnimationNone;
break;
case 5:
revealAnimation = MenuRevealAnimationSlide;
break;
case 6:
revealAnimation = MenuRevealAnimationFade;
break;
case 7:
revealAnimation = MenuRevealAnimationSlideAndFade;
break;
case 8:
revealAnimation = MenuRevealAnimationScale;
break;
case 9:
revealAnimation = MenuRevealAnimationScaleAndFade;
break;
default:
return;
}
if (vc)
[[SlideNavigationController sharedInstance] switchToViewController:vc withCompletion:nil];
else
[[SlideNavigationController sharedInstance] closeMenuWithCompletion:^{
[SlideNavigationController sharedInstance].menuRevealAnimation = revealAnimation;
}];
}
@end