0

I have a project that is using the SWReveal controller, however, when the user selects an item from the menu all the app is doing is refreshing the data on the front view controller meaning that a new view controller is never called so the rear view never gets dismissed.

How can I manually close the rear view controller? So when a user clicks on a menu item I want the rearview to disappear and be replaced again by the front view.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard;
storyboard = [UIStoryboard storyboardWithName:@"Main_iPad" bundle:nil];
NSString *SelectedRow = [self.menuItems objectAtIndex:indexPath.row];

if([[SelectedRow valueForKey:@"name"]isEqualToString:@"title"]){
    //Main Menu
    [self performSegueWithIdentifier:@"unwindToMenu" sender:self];
}
else
{
    NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
    [data setObject:[SelectedRow valueForKey:@"name"] forKey:@"name"];
    [data setObject:[SelectedRow valueForKey:@"jobNumber"] forKey:@"jobNumber"];
    [data setValue:[NSString stringWithFormat:@"%d", (indexPath.row -1)] forKey:@"indexNumber"];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"menuFormSelected" object:nil userInfo:data];

}

}

1 Answers1

0

I am not 100% sure what are you asking for , from what I understood you want to drag the menu back on menu button click so here is the easiest way to do so programatically.

To allow panGeture (to drag the menu).

SWRevealViewController *revealController = self.revealViewController;
[self.view addGestureRecognizer:revealController.panGestureRecognizer];

To allow getting back on menu click add to the menu button this.

[button addTarget:revealController action:@selector(revealToggle:)forControlEvents:UIControlEventTouchUpInside]; 
Coldsteel48
  • 3,482
  • 4
  • 26
  • 43