2016-06-15 6 views
0

UIScrollViewに10 UIButtonsが追加されました。 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

10個のボタンでスクロールビューを使用できる理由あなたは同じボタンが良い方法です再利用でtableviewを使用できますか?コードを共有する –

+0

縦方向に繰り返しスクロールする必要があります。スクロールをアニメートするときにタップする必要があります –

答えて

0

scrollview.userintreactionenable = yes; 私はあなたのためにこの助けと思います

+0

既に有効です。 –

関連する問題