简体   繁体   中英

IOS double tap trigger 2 segues

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 im 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM