1

をサブクラス化し、ペン先に をUIScrollView持っています。ジェスチャは正常に動作していましたが、Identity Inspector で のクラスを のサブクラスに変更すると、ジェスチャが機能しなくなり、Interface Builder でこの警告が表示されます。UIScrollViewUIScrollViewUIScrollView

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

ここに ScrollView.m があります

@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

ここで私が間違っていることを誰かが提案できますか? みんな、ありがとう :)

4

0 に答える 0