美文网首页ios积累
设置导航栏手势pop

设置导航栏手势pop

作者: 凤鹃一鸣 | 来源:发表于2017-07-31 16:38 被阅读2次

    模仿微信微信手势pop

    效果图

    模仿微信微信pop手势

    自定义导航继承UINavigationController

    - (void)viewDidLoad {

    [super viewDidLoad]; 

    NSArray *array = [self.interactivePopGestureRecognizer valueForKey:@"_targets"];    

    id target = [[array firstObject] valueForKey:@"target"];    

    SEL sel = @selector(handleNavigationTransition:);    

    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] init];   

     [self.interactivePopGestureRecognizer.view addGestureRecognizer:panGesture];   

     [panGesture addTarget:target action:sel];        

    self.navigationBar.barTintColor = [UIColor redColor];    

    self.navigationBar.tintColor = [UIColor whiteColor];    

    self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};    self.interactivePopGestureRecognizer.delegate = (id)self;

    }

    关注微信公众号“应讯”

    关注微信公众号“应讯”

    相关文章

      网友评论

        本文标题:设置导航栏手势pop

        本文链接:https://www.haomeiwen.com/subject/juerlxtx.html