如何解决uiscrollview子类来检测触摸不起作用
| 我使用此代码来检测在uiview顶部的uiscrollview上的触摸 子类 .h文件@interface AppScrollView : UIScrollView
{
}
@end
.m文件
#import \"AppScrollView.h\"
@implementation AppScrollView
- (id)initWithFrame:(CGRect)frame
{
return [super initWithFrame:frame];
}
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
// If not dragging,send event to next responder
if (!self.dragging)
[self.nextResponder touchesEnded: touches withEvent:event];
else
[super touchesEnded: touches withEvent: event];
}
@end
然后在另一堂课上我加了
#import <UIKit/UIKit.h>
@class AppScrollView;
@interface SomeClass : UIViewController <UIScrollViewDelegate>
{
AppScrollView *scrollView;
...
}
@end
#import \"AppScrollView.h\"
@implementation SomeClass
...
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
// Process the single tap here
...
}
...
@end
我也用了scroll1.delegate=self;
,但是什么也没发生!
谁能帮我?
解决方法
使用
Gesture Recognizers
。特别是ѭ5。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。