2016-04-07 30 views
0

こんにちは私はcollectionViewの項目に関する問題に直面しています。私の配列の素早く配列から行を見つける方法

var selectedPartecipants = [NSDate]() // this is the array [Item[0], Item[1] etc... ] 

func collectionView(collectionView: UICollectionView, didDeselectItemAtIndexPath indexPath: NSIndexPath) { 



      if let deselectedData:NSDate = partecipantsAtEvent[indexPath.row].date! { 


           if let index = selectedPartecipants.indexOf(deselectedData) { 

        selectedPartecipants.removeAtIndex(index) 
        ("item[0] cancelled - I have to search the item in collection view that now is new item[0] in the array") 


      } 

     } 


    } 

私はアイテムの選択を解除する[0]私のcollectionViewで、コードがアイテムを取り消し、[0]、今の私collectionViewに新しいアイテムを見つけたい、新しいアイテムです[0]私の配列で。何か案は?

+0

私は実際にあなたの問題が何であるか理解していません –

答えて

0

コレクションビューのすべてのアイテムを繰り返し処理するように思えます。ですから興味のあるものを見つけるには、あなたのpartecipantsAtEvent配列をループし、selectedParticpants [0]に一致する日付の項目を探します。

+0

それは私が何かを逃したようです...どのようにこの結果を達成することができますか? – user1679705

関連する問題