IPhone : How to call index on UICollectionView using IBAction?

on Tuesday, March 31, 2015

I am trying to put bunch of options on UICollectionView using IBAction as a trigger to open it each option, but I have difficulty what code should I call to trigger my action using IBAction. Here is my code:



@IBAction func openNewFilter(sender: AnyObject) {
self.collectionView.dataSource = indexPath.section == 0
}
func numberOfSections() -> Int {
return 2
}


func numberOfItemsInSection(_ section: Int) -> Int {
if section == 0 {
return array.count
} else if section == 1 {
return 1
} else {
return 0
}
}


func cellForItemAtIndexPath(_ indexPath: NSIndexPath) -> UICollectionViewCell? {
if indexPath.section == 0 {
} else if indexPath.section == 1 {
}
}


I would appreciate it if you could help me, thanks


0 comments:

Post a Comment