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

69 lines
1.5 KiB
Objective-C

//
// 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 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier];
switch (indexPath.row)
{
case 0:
cell.detailTextLabel.text = @"Home";
break;
case 1:
cell.detailTextLabel.text = @"Profile";
break;
case 2:
cell.detailTextLabel.text = @"Friends";
break;
}
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: @"ProfileViewController"];
break;
}
[[SlideNavigationController sharedInstance] switchViewController:vc withCompletion:nil];
}
@end