1
У меня есть коллекцияView и заголовок для этого коллекционного представления. Я добавил UISegmentControl в свой заголовок, и теперь я пытаюсь передать значение selectedSegmentIndex в main collectionView. Поэтому я пытаюсь добавитьTarget для этого сегмента в моем UICollectionViewController, но он ничего не возвращает, вот мой кодДействие добавления UICollectionView в заголовке (Swift)
override func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let headerView = self.collectionView?.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionHeader, withReuseIdentifier: "header", forIndexPath: indexPath) as collectionHeaderView
headerView.controlSegment.userInteractionEnabled = true
headerView.controlSegment.addTarget(self, action: "segmentAction:", forControlEvents: UIControlEvents.TouchUpInside)
return headerView
}
func segmentAction(sender: UISegmentedControl) {
println(sender.selectedSegmentIndex)
}
ооо блин правильно – Ankit