Iphone 为什么在将事件方法写入UIScrollView的子类之后仍然没有检测到它?

Iphone 为什么在将事件方法写入UIScrollView的子类之后仍然没有检测到它?,iphone,cocoa-touch,uiscrollview,Iphone,Cocoa Touch,Uiscrollview,我想对UIScrollView使用触摸事件方法。但有人说,只有我将UIScrollView子类化并在其中编写这些函数,我才能做到这一点。所以我喜欢这个 SubClassing.h @interface ImageTiling : UIScrollView { } @end SubClassing.m #import "ImageTiling.h" @implementation ImageTiling - (void)touchesBegan:(NSSet *)touches wit

我想对UIScrollView使用触摸事件方法。但有人说,只有我将UIScrollView子类化并在其中编写这些函数,我才能做到这一点。所以我喜欢这个

SubClassing.h
 @interface ImageTiling : UIScrollView {
}
@end

SubClassing.m
#import "ImageTiling.h"


 @implementation ImageTiling

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Touched" message:@"YOOY" delegate:nil cancelButtonTitle:@"YES" otherButtonTitles:nil];
[alert show];
[alert release];
}



- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Ended" message:@"YOOY" delegate:nil cancelButtonTitle:@"YES" otherButtonTitles:nil];
[alert show];
[alert release];
}
@end

但它没有任何效果。我已经在我的主文件.h中导入了它。现在该怎么办?

您是否将Interface Builder中的UIScrollView outlet类类型更改为ImageTiling类


另外,您最好使用NSLog(@“end”);不是为了调试而显示UIAlertView。

如果您指的是类标识,我对其进行了更改,但没有任何效果。是的,从现在起我将使用NSLog。您是否设置了实现UIScrollViewDelegate的委托?