这是是主线程只能同时响应一件事件的原因,你按着button是一个事件了,再拖拽又是一个事件,所以,可以通过以下方法来解决
1.设置属性scrolls.panGestureRecognizer.delaysTouchesBegan = YES;
2.自定义Button
-(id)initWithFrame:(CGRect)frame with:(UIScrollView *)scrollview
{
self = [super initWithFrame:frame];
if (self)
{
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan)];
[pan setDelegate:self];
[self addGestureRecognizer:pan];
[pan requireGestureRecognizerToFail:scrollview.panGestureRecognizer];
}
return self;
}
-(void)pan
{
NSLog(@"asds");
}