在UIButtons
中添加了10 UIScrollView
。写道使用UIAnimation
自动滚动滚动视图代码。
for (int i=0; i<10; i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(XPosition, YPosition, width,50);
[button setTitle:@"Warning animation items array " forState:UIControlStateNormal];
button.tag = i;
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
if (index%2) {
button.backgroundColor = [UIColor blueColor];
} else{
button.backgroundColor = [UIColor purpleColor];
}
XPosition = paddingSpace + XPosition + button.frame.size.width;
[_scroll addSubview:button];
index++;
}
_scroll.contentSize=CGSizeMake(XPosition,50);
动画UIScrollView
时,我无法点按任何UIButton
!!!
[UIView animateWithDuration:20
delay:0.0
options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat)
animations:^{
_scroll.contentOffset = CGPointMake(XPosition, 0.0);
} completion:^(BOOL finished){}];
如果动画停止,我可以点按UIButton
。
请帮我解决这个问题。
答案 0 :(得分:0)
你可以使用scrollview.userintreactionenable = yes; 我认为这对你有帮助