我有一个UIScrollView
里面有按钮,当我试图按下一个按钮并滑动到一边时UIScrollView
它不会移动,但是当我滑动得非常快时它会移动。我UIControlEventTouchUpInside
在按钮上使用。这是我用来向滚动视图添加按钮的代码:
-(void) setScrollView:(int) numberOfViews {
for (int i = 0; i < numberOfViews; i++) {
CGFloat xOrigin = i * 40;
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self
action:@selector(scrollViewButtonClicked:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:[NSString stringWithFormat:@"%d",i] forState:UIControlStateNormal];
button.frame = CGRectMake(xOrigin, 0, 40, 40);
button.tag = 1000+i;
button.backgroundColor = [self getColorForSound:self.sounds[i]];
[button setExclusiveTouch:YES];
[self.soundsScrollView addSubview:button];
}
}
UIScrollView
即使用户按下按钮并尝试滚动,我该如何进行滚动?