UIScrollView无法响应touches的解决方法

时间:2022-04-22
本文章向大家介绍UIScrollView无法响应touches的解决方法,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

自定义一个类继承UIScrollView,将touchesEnded事件发送出去。

#import <Foundation/Foundation.h>


@interface PageScrollView : UIScrollView {

}

@end
#import "PageScrollView.h"


@implementation PageScrollView
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {
	
	if (!self.dragging) {
		[self.nextResponder touchesEnded: touches withEvent:event]; 
	}		
	[super touchesEnded: touches withEvent: event];
}

@end