if ([self class] = = [Homeviewcontroller class]| | [Self class] = = [Comprehensivefinanceviewcontroller class]| | [Self class] = = [Mycenterviewcontroller class]| | [Self class] = = [Customermanageviewcontroller class]) {
Add left sweep and right sweep gestures
Uiswipegesturerecognizer *swipeleft = [[Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector ( Tappedrightbutton:)];
[Swipeleft Setdirection:uiswipegesturerecognizerdirectionleft];
[Self.view Addgesturerecognizer:swipeleft];
Uiswipegesturerecognizer *swiperight = [[Uiswipegesturerecognizer alloc] initwithtarget:self action: @selector ( Tappedleftbutton:)];
[Swiperight Setdirection:uiswipegesturerecognizerdirectionright];
[Self.view Addgesturerecognizer:swiperight];
Write to master controller and swipe gesture listener in base class controller
-(Ibaction) Tappedrightbutton: (ID) sender
{
Nsuinteger SelectedIndex = [Self.tabbarcontroller selectedindex];
Nsarray *aryviewcontroller = self.tabBarController.viewControllers;
if (SelectedIndex < aryviewcontroller.count-1) {
UIView *fromview = [Self.tabBarController.selectedViewController view];
//
UIView *toview = [[Self.tabBarController.viewControllers objectatindex:selectedindex + 1] view];
//
[UIView transitionfromview:fromview Toview:toview duration:0.5f options:uiviewanimationoptiontransitionflipfromr Ight completion:^ (BOOL finished) {
//
if (finished) {
[Self.tabbarcontroller Setselectedindex:selectedindex + 1];
// }
//
// }];
}
}
-(Ibaction) Tappedleftbutton: (ID) sender
{
Nsuinteger SelectedIndex = [Self.tabbarcontroller selectedindex];
if (SelectedIndex > 0) {
UIView *fromview = [Self.tabBarController.selectedViewController view];
//
UIView *toview = [[Self.tabBarController.viewControllers objectatindex:selectedindex-1] view];
[UIView transitionfromview:fromview Toview:toview duration:0.5f options:uiviewanimationoptiontransitionflipfroml EFT completion:^ (BOOL finished) {
//
if (finished) {
[Self.tabbarcontroller setselectedindex:selectedindex-1];
// }
//
// }];
}
}
This allows the global slide to return
If the Web controller implements the sliding return function, it must be implemented in Wkwebview
_wkwebview.allowsbackforwardnavigationgestures = yes;//Open webview page slide back
}else{
Self.navigationController.interactivePopGestureRecognizer.delegate = (id) self;
}
It's so simple.
IOS app all add swipe back