2016-08-08 14 views
0

Ich habe eine UICollectionView kontinuierliche Scrollen NSTimer verwenden, hier ist der CodeTippen wird beim kontinuierlichen Scrollen von UICollectionView iOS nicht erkannt?

let timer = NSTimer(timeInterval: 0.1, target: self, selector: #selector(HomeViewController.scrollToNextCard), userInfo: nil, repeats: true) 
NSRunLoop.currentRunLoop().addTimer(timer!, forMode: NSDefaultRunLoopMode) 

func scrollToNextCard(){ 
    UIView.animateWithDuration(0.1, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: { 
       // I am changing the contentOffset of collectionview for continuous scrolling 
     }, completion: {(finished:Bool) in 

    }) 

Wenn auf einem sichtbaren Zellen tippen, wenn im Gange Scrollen wird Methode didSelectItemAtIndexpath der Stellvertretung nicht genannt zu werden. Wie erreiche ich die Tapping-Erkennung bei gleichzeitigem Scrollen der Sammlungsansicht? Bitte helfen Sie dank

+0

Try 'NSRunLoopCommonModes' statt' NSDefaultRunLoopMode'. – Santosh

+0

Nein, das funktioniert nicht. – coder123

Antwort

1

fand ich die Antwort für das gleiche, ich hatte AllowUserInteraction Flagge auf dem Animationsblock wie im Code hinzuzufügen:

func scrollToNextCard(){ 
    UIView.animateWithDuration(Constants.CardFlowTimeInterval, delay: 0.0, options: [.CurveEaseInOut,.AllowUserInteraction], animations: { 
     }, completion: {(finished:Bool) in 
    }) 
} 
Verwandte Themen