Arun Arun - 22 days ago 8
iOS Question

How to resign SWRevealViewController?

I am using SWRevealViewController to implement sidebar in my IOS app.I have followed appcoda tutorial to implement it, I need to resign the sidebar to orignal position in a tableview row click can anyone help with the answer.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SWRevealViewController *revealViewController = self.revealViewController;
if ( revealViewController )
{
// [self.sidebarButton setTarget: self.revealViewController];
// [self.sidebarButton setAction: @selector( revealToggle: )];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}

}

Answer

If you want to just toggle the easiest way is to call this in the viewcontroller with your tableview

[self.revealViewController revealToggleAnimated:YES];

Don't forget to put this import

import <SWRevealViewController/SWRevealViewController.h>

Comments