Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 手势识别器在UIScrollView子类中不工作_Iphone_Ios_Xcode_Ios5_Uiscrollview - Fatal编程技术网

Iphone 手势识别器在UIScrollView子类中不工作

Iphone 手势识别器在UIScrollView子类中不工作,iphone,ios,xcode,ios5,uiscrollview,Iphone,Ios,Xcode,Ios5,Uiscrollview,我已经对UIScrollView进行了子类化,我的nib中有一个UIScrollView,手势可以很好地工作,但是当我将Identity Inspector中的UIScrollView类更改为UIScrollView子类时,手势停止工作,我的界面生成器中出现了此警告 ScrollView does not have an outlet collection named gestureRecognizors. 我的子类中还有一个委托,它也给出了一个警告: 下面是子类: @protocol Scr

我已经对UIScrollView进行了子类化,我的nib中有一个UIScrollView,手势可以很好地工作,但是当我将Identity Inspector中的UIScrollView类更改为UIScrollView子类时,手势停止工作,我的界面生成器中出现了此警告

ScrollView does not have an outlet collection named gestureRecognizors.
我的子类中还有一个委托,它也给出了一个警告:

下面是子类:

@protocol ScrollViewDelegate <NSObject>

-(void)onScrollViewTouch;

@end


@interface ScrollView : UIScrollView <UIScrollViewDelegate>

@property(nonatomic, retain) id<ScrollViewDelegate> subDelegate;

@end

有人能告诉我我做错了什么吗?谢谢大家:

尝试更改您的子类名称,可能会有类似该名称的关键字..我尝试了相同的方法,效果更好,touchsbegind被调用。。如何在自定义滚动视图上设置子委托和添加任何其他UIgestureRecognitor。?是的,UIgestureRecognitor是通过界面生成器添加的。发出上述警告且不起作用的。触摸屏工作正常。
@implementation ScrollView

@synthesize subDelegate;

- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
    self.canCancelContentTouches = NO;
    self.delaysContentTouches = NO;
    [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
    [super setDelegate: self];
}
return self;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesBegan:touches withEvent:event];
[delegate onScrollViewTouch];
}

@end