I am using SWRevealViewController to impliment sidebar in my ios app.I have followed appcoda tutorial to implement it.As per this tutorial I have made two segue's sw_front which is for main viewcontroller(rootviewcontroller) and second one is sw_rear which is for sidebar.I am successfully able to implement it using this tutorial,but now I am getting problem in navigating from sw_rear view to sw_front segue.Please, help me if anyone knows this kind of problem.
Asked
Active
Viewed 3,065 times
4
-
1Can you explain a little bit more? I understand you have a problem for navigating from sw_rear to sw_front but what is actually the error? Is it not working? – Steve Sahayadarlin Jan 27 '15 at 16:34
-
No, their is not any error, it is working fine but, If i enter in one of the viewcontroller from the sidebar menu, now from this viewcontroller I wanted to navigate to main view i.e. sw_front segue rootviewcontroller. – Akshaykumar Maldhure Jan 28 '15 at 04:58
1 Answers
1
This my slidemenu.m
All you have to do Create table of your menu Items , Each item has identifier
Click right in each item , choose reveal view controller
that all
#import "SlideMenu.h"
#import "SWRevealViewController.h"
@interface SlideMenu ()
@end
@implementation SlideMenu{
NSArray *menu_items;
NSArray*thumbies;
NSArray*indentifer;
}
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
indentifer = @[@"report_view" ,@"ann_view" , @"message_view" , @"calendar_view" , @"schedule_view" , @"about_view" , @"student_view" ];
menu_items = @[@"Reports" , @"Messages" , @"Announcement" , @"Calendar" ,@"Schedule" ,@"About us",@"back to Students"];
thumbies = @[@"report.png" , @"message.jpg" ,@"ann.jpg", @"calendar.jpg" , @"schedule.png" , @"about.png" ];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [menu_items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString * cell_identifer = [indentifer objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cell_identifer forIndexPath:indexPath];
if (cell== nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cell_identifer];
}
//cell.textLabel.text = [menu_items objectAtIndex:indexPath.row];
//cell.imageView.image = [UIImage imageNamed:[thumbies objectAtIndex:indexPath.row] ];
return cell;
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue isKindOfClass:[SWRevealViewControllerSegue class]]) {
SWRevealViewControllerSegue *swsegue = (SWRevealViewControllerSegue*)segue;
swsegue.performBlock = ^(SWRevealViewControllerSegue *rvc_segue , UIViewController * svc , UIViewController *dvc){
UINavigationController *navController = (UINavigationController *)self.revealViewController.frontViewController;
[navController setViewControllers:@[dvc] animated:NO];
[self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES];
};
}
}
@end
UPDATE ANSWER FOR XCODE 6.4
FULL EXAMPLE
create viewController to hold SWRevealViewController
class
this view has rear (slide menu items) , front (implemented items) please check screen shots
from your slide menu viewController class to each item
this table view implement my slide menu items , I use push method
(SWRevealViewControllerSeguePushController)
here is connection inspector before navigation controller
hope this answer all your questations

Mina Fawzy
- 20,852
- 17
- 133
- 156
-
Thank you very much for your reply, Can you please explain me how I have to use it, more briefly? – Akshaykumar Maldhure Jan 29 '15 at 11:41
-
@minafawzy.. Hi. i am using SWRevealviewController for iOS 6 project. And as per your instructions i am not getting "SWRevealViewControllerSegue" instead i am getting "SWRevealViewControllerPushSegue" or "SWRevealViewControllerSetSegue". What should i do? – TheGaME Aug 29 '15 at 14:55
-
sorry for late answer use SWRevealViewControllerSeguePushController instead I will update my answer – Mina Fawzy Sep 02 '15 at 11:16
-
@MinaFawzy can you send yor exmple code. so i can download and implement easily. thank x in advance... – Raju Aug 19 '16 at 11:22
-
menu_items array was dynamic how can we implement with out static cells? – RameshIos Nov 22 '16 at 06:25