var selectedIndexPath: NSIndexPath?
// MARK: - UICollectionViewDelegate
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
selectedIndexPath = indexPath
collectionView.performBatchUpdates(nil, completion: nil)
}
// MARK: - UICollectionViewDelegateFlowLayout
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
var size = CGSize(width: 100, height: 100)
if selectedIndexPath == indexPath {
size.width = CGRectGetWidth(collectionView.frame)
}
return size
}
예, 그것은 간단합니다.
(. 좋은 생각인지 그 질문에 대답하지 않지만 당신은 당신이 그것을 구현할 때 볼)
이이 레이아웃 아니면 그 것이다 내장 플로우 레이아웃? – matt
하위 분류 UICollectionFlowLayout이 시작되었습니다. – bevbomb
글쎄, 그렇게 할 필요는 없습니다. 플로우 레이아웃에는 델리게이트가 있습니다. 원하는 크기로 항목을 만들 수 있습니다. 그냥'sizeForItemAtIndexPath :'를 구현하십시오. – matt