。h文件
#import <UIKit/UIKit.h>
@interface MyScrollView : UIScrollView
<UIScrollViewDelegate>
@end
。m文件
#import "MyScrollView.h"
@implementation MyScrollView
-(BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view{
if([view isKindOfClass:[UIButton class]]){
[[self nextResponder]touchesEnded:touches withEvent:event];
return YES;
}else{
return NO;
}
}
-(BOOL)touchesShouldCancelInContentView:(UIView *)view{
return NO;
}
@end