码迷,mamicode.com
首页 > 其他好文 > 详细

左右滑动页面

时间:2015-06-13 18:19:26      阅读:88      评论:0      收藏:0      [点我收藏+]

标签:

 

#pragma mark- 滑动

@property (nonatomic, strong)UISwipeGestureRecognizer *leftSwipeGestureRecognizer;

@property (nonatomic, strong)UISwipeGestureRecognizer *rightSwipeGestureRecognizer;

 

 

#pragma mark- 初始化滑动页面

 

-(void)handleSwipesInit{

    self.leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc]

                                       initWithTarget:self action:@selector(handleSwipes:)];

    self.rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipes:)];

    

    self.leftSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;

    self.rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;

    

    [self.view addGestureRecognizer:self.leftSwipeGestureRecognizer];

    [self.view addGestureRecognizer:self.rightSwipeGestureRecognizer];

}

 

#pragma mark- 滑动页面

 

- (void)handleSwipes:(UISwipeGestureRecognizer *)sender

{

    if (sender.direction == UISwipeGestureRecognizerDirectionLeft) {

        

    }

    

    if (sender.direction == UISwipeGestureRecognizerDirectionRight) {

        [self backingtomainview];

    }

}

 

左右滑动页面

标签:

原文地址:http://www.cnblogs.com/niexiaobo/p/4573784.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!