给SCrollView 添加单击事件

来源:互联网 发布:mac珊瑚红唇膏 编辑:程序博客网 时间:2024/05/22 06:30
12345678910111213141516171819202122232425262728
//
// GAScrollView.h
// Car
//
// Created by apple on 11-12-17.
// Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol GAScrollViewDelegate;

@interface GAScrollView : UIScrollView
{
    id<GAScrollViewDelegate> GADelegate_;
}

@property (nonatomic, assign) id<GAScrollViewDelegate> GADelegate;

@end


@protocol GAScrollViewDelegate <UIScrollViewDelegate>

@optional
- (void) GAScrollView:(GAScrollView *)scroll touchBegin:(NSSet *)touches withEvent:(UIEvent *)event;

@end
nameage
history
messagefileGAScrollView.hDecember 17, 20111.0 [SuiFeng]fileGAScrollView.mDecember 17, 20111.0 [SuiFeng]
  • Edit this fileTxt
123456789101112131415161718192021222324
//
// GAScrollView.m
// Car
//
// Created by apple on 11-12-17.
// Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "GAScrollView.h"

@implementation GAScrollView

@synthesize GADelegate = GADelegate_;

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesBegan:touches withEvent:event];
    [self.superview touchesBegan:touches withEvent:event];
    if ([GADelegate_ respondsToSelector:@selector(GAScrollView:touchBegin:withEvent:)]) {
        [GADelegate_ GAScrollView:self touchBegin:touches withEvent:event];
    }
}

@end