以UIImageView为例
首先继承系统UIScrollView自定义一个UIScrollView
#import "HWScrollVIew.h"
@implementation HWScrollVIew
// 拖动来(只要这个就可以了)
-(BOOL)touchesShouldCancelInContentView:(UIView *)view{
if ([view isKindOfClass:[UIImageView class]]) {
return NO;
}
return YES;
}
@end
外部使用
HWScrollVIew *scrollV = [[HWScrollVIew alloc]initWithFrame:CGRectMake(0, 0, 320, 600 )];
scrollV.delaysContentTouches = NO;
scrollV.canCancelContentTouches = YES;
只要拖动的是HWScrollVIew上的所有UIImageView控件,HWScrollVIew都不会滚动,冲突解决