首页 > 其他 > 详细

UIScrollView解决无法触发手势

时间:2015-11-25 13:09:22      阅读:353      评论:0      收藏:0      [点我收藏+]

//创建一个分类

//.h

#import <UIKit/UIKit.h>

@interface UIScrollView (Touch)

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

@end

 

//.m

#import "UIScrollView+Touch.h"

 @implementation UIScrollView (Touch)

 

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self nextResponder] touchesBegan:touches withEvent:event];

    [super touchesBegan:touches withEvent:event];

}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self nextResponder] touchesMoved:touches withEvent:event];

    [super touchesMoved:touches withEvent:event];

}

 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self nextResponder] touchesEnded:touches withEvent:event];

    [super touchesEnded:touches withEvent:event];

}

 @end

 

/**工程中调用*/

- (void)viewDidLoad {

    [super viewDidLoad]; 

    //实现scroll触摸屏幕

    [self touchesBegan:nil withEvent:nil];

    [self touchesMoved:nil withEvent:nil];

    [self touchesEnded:nil withEvent:nil];

}

 

UIScrollView解决无法触发手势

原文:http://www.cnblogs.com/TheYouth/p/4994185.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!