iOS全屏滑动代码

usib8630的头像 usib8630 0 2016-03-05 20:36 0

 基本信息

× 1   

浏览数: 19809

分享时间: 2 年 前

2
- (void)viewDidLoad {
    [super viewDidLoad];   
     // 获取系统自带滑动手势的target对象
    id target = self.interactivePopGestureRecognizer.delegate; 
       // 创建全屏滑动手势,调用系统自带滑动手势的target的action方法
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:target action:@selector(handleNavigationTransition:)];    // 设置手势代理,拦截手势触发
    pan.delegate = self;   
     // 给导航控制器的view添加全屏滑动手势
    [self.view addGestureRecognizer:pan];   
     // 禁止使用系统自带的滑动手势
    self.interactivePopGestureRecognizer.enabled = NO;

}
// 什么时候调用:每次触发手势之前都会询问下代理,是否触发。
// 作用:拦截手势触发
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{    // 注意:只有非根控制器才有滑动返回功能,根控制器没有。
    // 判断导航控制器是否只有一个子控制器,如果只有一个子控制器,肯定是根控制器
    if (self.childViewControllers.count == 1) {       
     // 表示用户在根控制器界面,就不需要触发滑动手势,
        return NO;
    }    return YES;
}



12 [下一页]

  • 741273122的头像 741273122 2016-08-08 14:18 代码数:0

    什么用?

  • cixexey的头像 cixexey 2018-05-14 19:21 代码数:0

    I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks.click here

  • cixexey的头像 cixexey 2018-05-14 19:22 代码数:0

    Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks click here

  • cixexey的头像 cixexey 2018-05-21 17:43 代码数:0

    Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.Colorado SEO services

  • cixexey的头像 cixexey 2018-06-22 23:11 代码数:0

    This type of message always inspiring and I prefer to read quality content, so happy to find good place to many here in the post, the writing is just great, thanks for the post.

    בניית אתרים

  • cixexey的头像 cixexey 2018-06-24 18:39 代码数:0

    I would like to say that this blog really convinced me to do it! Thanks, very good post.

    KFZ Widerruf

  • cixexey的头像 cixexey 2018-06-27 18:56 代码数:0

    I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! appellate lawyers Georgia

  • cixexey的头像 cixexey 2018-06-30 16:39 代码数:0

    Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..cryptocurrency game

  • cixexey的头像 cixexey 2018-06-30 19:18 代码数:0

    Thanks for your information, it was really very helpfull..a course in miracles

  • cixexey的头像 cixexey 2018-07-01 22:09 代码数:0

    I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! acim

     

您的评论: