OGeek|极客世界-中国程序员成长平台

标题: ios - 如何为 UINavigationController 启用全屏平移 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:29
标题: ios - 如何为 UINavigationController 启用全屏平移

从 iOS7 开始,苹果提供了一种平移 UINavigationController 的方法,但只能通过从屏幕边缘滑动来完成。如何启用全屏平移后退手势?



Best Answer-推荐答案


我真的花了很多时间试图解决这个问题,最后我找到了方法。我只是提出一个问题并自己回答以在这里分享解决方案。

请引用我的博客以获取更多详细信息enter link description here

演示代码:

#import "TestNavigationController.h"

@interface _UINavigationInteractiveTransition

@end

@interface UINavigationController(Custom)
@property (strong, nonatomic) _UINavigationInteractiveTransition * _cachedInteractionController;

@end

@implementation TestNavigationController
{
    UIPanGestureRecognizer *_p;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@", self.interactivePopGestureRecognizer
          );
    _p = [[UIPanGestureRecognizer alloc]initWithTarget:self._cachedInteractionController actionselector(handleNavigationTransition];
    NSLog(@"%@", self._cachedInteractionController);
    [self.view addGestureRecognizer:_p];
   } 
@end

编辑说明: 这会暴露私有(private) API。

关于ios - 如何为 UINavigationController 启用全屏平移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35427451/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4