UITableView push segue fires several times

I encountered a strange error in my application:

Customization

A simple "Master-Detail" application, iPhone style (i.e. not a split view, not a popover, just a navigation controller, a table view controller and a view controller).

enter image description here

Error

  • Touch the β€œbackground” part of the table view (dark gray parts in the screenshot), for example, the header or footer of the section.
  • While holding your finger on the screen, tap the cell several times.
  • Release all fingers. The "detailed" view will move normally, but when you touch the "Back" button, you will find that the detailed view has been stacked as many times as you touched the cell in step 2.

enter image description here

2, :)

, Twitter iPhone ( "" β„–1 ).

"" "" ( ).

iOS 6.0 6.1. .

/ () ? iOS ( , Apple)?

+5
2

Apple iOS 7.

Dan F .

0

-, ,

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender

boolean -, , segue. :

BOOL doingSegue = NO;

-(void) viewWillAppear
{

    doingSegue = NO;
}

- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender
{

    if ( [identifier isEqualToString:@"MySegueIdentifier"] )
    {
        if ( doingSegue )
        {
            return NO;
        }
        else
        {
            doingSegue = YES;
            return YES;
        }
    }
    return YES;
}

var doingSegue = false

override func viewWillAppear(_ animated: Bool) {
    doingSegue = false
}

override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
    if identifier == "MySegueIdentifier" {
        if doingSegue {
            return false
        }
        else {
            doingSegue = true
            return true
        }
    }
    return true
}
+3

All Articles