Reputation: 941
I am using SWRevealViewController to show right side menu. I am not using BarButtons but i have taken a normal button as my app dont have Navigation bar. The problem i am facing is when i touch that button the methods work properly but i cant see the menu bar coming in, and on second touch the side menu comes in. I am not able to figure out the issue. Help Much Appreciated. '
-(IBAction)btnMenuClicked:(id)sender
{
SideMenuTableViewController *sidemenuController = (SideMenuTableViewController *)revealViewController.rightViewController;
sidemenuController.pitcherArray = [nTimerArray mutableCopy];
revealViewController.rearViewRevealWidth = self.view.bounds.size.width - 50;
if (revealViewController)
{
[self.btnMenu addTarget:self.revealViewController action:@selector(rightRevealToggle:) forControlEvents:UIControlEventTouchUpInside];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
[self.view addGestureRecognizer:self.revealViewController.tapGestureRecognizer];
}
[sidemenuController.tableView reloadData];
}
'
Upvotes: 1
Views: 988
Reputation: 1237
Import SWRevealViewController
first
#import "SWRevealViewController.h"
Create a property
for the button as follows...
@property (weak, nonatomic) IBOutlet UIButton *rearButton;
And in the ViewDidLoad
method just use this code. It will help you with your problem.
- (void)viewDidLoad {
[super viewDidLoad];
SWRevealViewController *revealViewController = self.revealViewController;
if ( revealViewController )
{
[self.rearButton addTarget:self.revealViewController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside];
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
}
}
Upvotes: 2
Reputation: 554
remove tapGestureRecognizer
. It might be work
[self.view addGestureRecognizer:self.revealViewController.tapGestureRecognizer];
Upvotes: 0