You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(void)fd_setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
{
for(UIViewController *viewController in viewControllers){
if (![self.interactivePopGestureRecognizer.view.gestureRecognizers containsObject:self.fd_fullscreenPopGestureRecognizer]) {
// Add our own gesture recognizer to where the onboard screen edge pan gesture recognizer is attached to.
[self.interactivePopGestureRecognizer.view addGestureRecognizer:self.fd_fullscreenPopGestureRecognizer];
// Forward the gesture events to the private handler of the onboard gesture recognizer.
NSArray *internalTargets = [self.interactivePopGestureRecognizer valueForKey:@"targets"];
id internalTarget = [internalTargets.firstObject valueForKey:@"target"];
SEL internalAction = NSSelectorFromString(@"handleNavigationTransition:");
self.fd_fullscreenPopGestureRecognizer.delegate = self.fd_popGestureRecognizerDelegate;
[self.fd_fullscreenPopGestureRecognizer addTarget:internalTarget action:internalAction];
// Disable the onboard gesture recognizer.
self.interactivePopGestureRecognizer.enabled = NO;
}
[self fd_setupViewControllerBasedNavigationBarAppearanceIfNeeded:viewController];
在使用setViewControllers:animated:方法一次性push多个Controller到栈里时,某个Controller设置的禁止侧滑功能没有生效,需要对setViewControllers:animated:要像pushViewController:animated:一样支持,添加方法如下:
{
// Inject "-setViewControllers:animated:"
Method originalMethod = class_getInstanceMethod(self, @selector(pushViewController:animated:));
Method swizzledMethod = class_getInstanceMethod(self, @selector(fd_pushViewController:animated:));
method_exchangeImplementations(originalMethod, swizzledMethod);
// Inject "-pushViewController:animated:"
Method originalMethod2 = class_getInstanceMethod(self, @selector(setViewControllers:animated:));
Method swizzledMethod2 = class_getInstanceMethod(self, @selector(fd_setViewControllers:animated:));
method_exchangeImplementations(originalMethod2, swizzledMethod2);
}
(void)fd_setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
{
for(UIViewController *viewController in viewControllers){
if (![self.interactivePopGestureRecognizer.view.gestureRecognizers containsObject:self.fd_fullscreenPopGestureRecognizer]) {
}
[self fd_setViewControllers:viewControllers animated:animated];
}
The text was updated successfully, but these errors were encountered: