IOS double-click tabbar to refresh the page, and iostabbar to refresh the page
/* Inherit the UITabBarController */
# Pragma mark <UITabBarControllerDelegate>
-(Void) tabBarController :( UITabBarController *) tabBarController didSelectViewController :( UIViewController *) viewController {
If ([self doubleClick]) {
UINavigationController * navigation = (UINavigationController *) viewController;
If ([navigation. topViewController respondsToSelector: @ selector (tabbarDoubleClick)]) {
[Navigation. topViewController performSelector: @ selector (tabbarDoubleClick)];
}
}
}
/* Determine whether it is double-click (because the system does not provide the double-click method, you can determine by clicking the interval )*/
-(BOOL) doubleClick {
NSDate * date = [NSDate date];
If (date. timeIntervalSince1970-self. lastDate. timeIntervalSince1970 <0.5 ){
// After a double-click is completed, reset the time of the first click to distinguish between three or multiple clicks.
Self. lastDate = [NSDate dateWithTimeIntervalSince1970: 0];
Return YES;
}
Self. lastDate = date;
Return NO;
}
# Prama mark-proxy Implementation Method
/* On the interface to be refreshed */
-(Void) tabbarDoubleClick {
}