左右手势的滑动,来切换页面

发布时间:2020-06-26 03:50:47 作者:Im刘亚芳
阅读:1121
开发者专用服务器限时活动,0元免费领! 查看>>

    //向左滑动的时候的手势

    UISwipeGestureRecognizer *leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(presentRightMenuViewController:)];

    [leftSwipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionLeft];

    [self.view addGestureRecognizer:leftSwipeGestureRecognizer ];

    //向右滑动时候的手势

    UISwipeGestureRecognizer *rithSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(presentRightMenuViewController:)];

    [rithSwipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];

    [self.view addGestureRecognizer:rithSwipeGestureRecognizer ];

- (void)presentRightMenuViewController:(UISwipeGestureRecognizer *)dddd

{

    [self.navigationController popViewControllerAnimated:YES];

}

那么问题来咯,现在返回上一个页面后,会崩溃,错误原因,  -------待结果

2014-11-11 21:33:18.907 LYF_video[7979:258930] *** -[UIImageView superview]: message sent to deallocated instance 0x7fb2f3ea8870






    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)];

    tap.numberOfTapsRequired = 1;

    [self.view addGestureRecognizer:tap];

//点击一次的手势

- (void)tapClick

{

    static BOOL flag = YES;

    if (flag == YES) {

        self.viewTitle.hidden = NO;

        flag = NO;

        

    }else{

        self.viewTitle.hidden = YES;

        flag = YES;

    }

    

}

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:
  1. GestureDetector、手势、左右滑动控制图片大小
  2. 基于Vue实现页面切换左右滑动效果

开发者交流群:

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

action 左右

上一篇:字节对齐-------结构体、共用体

下一篇:Ruby模版方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
开发者交流群×