Reputation: 1512
i'm currently working on a ios App which is based on https://github.com/stefanoa/SASlideMenu (side menu classes) and a storyboard.
On my right menu I've connected a button with a custom segue (SASlideMenuPushSegue). This is working fine in a normal use but if i'm tapping fast enough on the button, i can manage to push more view.
For example, if i m double tapping on the button 2 views will be pushed. I have no idea where it comes from. Here is the segue code :
-(void) perform{
SASlideMenuRightMenuViewController* source = self.sourceViewController;
SASlideMenuRootViewController* root = source.rootController;
SASlideMenuNavigationController* destination = self.destinationViewController;
[root pushRightNavigationController:destination];
}
Any idea of the source of this bug ? Thanks for your answer.
Upvotes: 2
Views: 790
Reputation: 1827
Put a BOOL isPressed
inside and check if the button was pressed before in that particular class.
-(void) perform
{
if(!isPressed)
{
SASlideMenuRightMenuViewController* source = self.sourceViewController;
SASlideMenuRootViewController* root = source.rootController;
SASlideMenuNavigationController* destination = self.destinationViewController;
[root pushRightNavigationController:destination];
isPressed = YES;
}
}
and just reset isPressed
. I encountered the same thing with segue when i presented a popovercontroller
it was pressenting each time i was pressing the button one over another,so i think we need to handle this behavior.
Upvotes: 1