2
我試圖在選中單元格時更改UICollectionView
中單元格的高度。收集視圖更改單元格大小
我設法改變高度,但是當我選擇一個單元格時,其他單元格的y
位置不會改變,導致選擇的單元格與其他單元格重疊。
如何告訴其他細胞改變y位置細胞高度被修改?
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
if let detailsCell = collectionView.cellForItemAtIndexPath(indexPath) as? UserDetailsCell {
UIView.animateWithDuration(0.5, delay: 0, options: .TransitionCurlUp, animations: {
detailsCell.frame.size.height = 300
}, completion: nil)
}
print(indexPath.row)
}
謝謝!然而在收集視圖委託我count找'heightForRowAtIndexPath' – SNos
如果你不能只使用一個UItableView,你將不得不創建一個UICollectionViewFlowLayout它是更多的工作,我建議如果可能的話遷移到UITableView。 –
檢查此代表:collectionView:layout:sizeForItemAtIndexPath: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewDelegateFlowLayout_protocol/ –