码迷,mamicode.com
首页 > 移动开发 > 详细

iOS滑动手势UIPanGestureRecognizer 注意事项

时间:2018-04-11 17:03:50      阅读:431      评论:0      收藏:0      [点我收藏+]

标签:uiview   oat   ipa   max   sele   set   ios   计算   趋势   

添加滑动手势

    //添加滑块

    UIPanGestureRecognizer *recognizerA = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];

    [recognizerA setMaximumNumberOfTouches:1];

  //滑块大小

    _AView = [[UIView alloc] initWithFrame:CGRectMake(0,0, 100,150)];

    [_AView addGestureRecognizer:recognizerA];

 

/**

 * @brief 滑动模块

 */

#pragma mark --滑动模块

- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer {

 

    //松开手指时判断滑动趋势让其计算滑动位子

    if (recognizer.state == UIGestureRecognizerStateEnded) {

        [self updateRelationships];

    }

}

/**

 * @brief 滑动大小

 */

#pragma mark --滑动大小

-(void)updateRelationships{

       NSLog(@"update-CGFloat_x::%f",AView.frame.origin.x);

    NSLog(@"update-CGFloat_x::%f",AView.frame.origin.y);

    

}

iOS滑动手势UIPanGestureRecognizer 注意事项

标签:uiview   oat   ipa   max   sele   set   ios   计算   趋势   

原文地址:https://www.cnblogs.com/lanmaokomi/p/8796620.html

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