// 防止多次调用 #define kPreventRepeatClickTime(_seconds_) \ static BOOL shouldPrevent; \ if (shouldPrevent) return; \ shouldPrevent = YES; \ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((_seconds_) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ \ shouldPrevent = NO; \ }); \
// in front of the method to be performed plus kPreventRepeatClickTime (0.5); to solve the user clicks in rapid succession problems caused by the implementation of the multi - ( void ) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath * ) indexPath { kPreventRepeatClickTime ( 0.5 ) ; the UIViewController * detailVc = [[the UIViewController the alloc] the init]; [self.navigationController pushViewController: Animated detailVc: YES]; } - ( void ) {buttnClick kPreventRepeatClickTime ( 0.5 ); NSLog ( @ " clicked:% ld times " , + + _nums); }