2016-06-15 30 views
0

Hinzugefügt 10 UIButtons in einem UIScrollView. Schrieb automatisch den Bildlaufkode mit UIAnimation.Scroll-Ansicht Schaltfläche Aktion funktioniert nicht beim Animieren

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); 

Wenn die UIScrollView Animieren, kann ich jede UIButton nicht in der Lage Hahn !!!

[UIView animateWithDuration:20 
         delay:0.0 
        options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat) 
       animations:^{ 
        _scroll.contentOffset = CGPointMake(XPosition, 0.0); 
       } completion:^(BOOL finished){}]; 

Wenn die Animation nur stoppen ich die UIButton anzapfen können.

Bitte helfen Sie mir dies.

+0

Setzen Sie Ihren Code der Animation. –

+0

Warum können Sie die Scrollview mit 10 Tasten verwenden. Können Sie TableView mit der Wiederverwendung der gleichen Schaltfläche verwenden, ist ein besserer Weg. teilen Sie Ihren Code –

+0

Muss vertikal wiederholt scrollen. Ich muss tippen, wenn der Bildlauf animiert wird –

Antwort

0

können Sie scrollview.userintreactionenable = yes verwenden; Ich denke diese Hilfe für Sie

+0

Es ist bereits aktiviert. –