【发布时间】:2017-03-29 03:27:44
【问题描述】:
您好,我有一个简单的水平唯一 uicollectionview,我想弹出 UICollectionViewCell。
当我单击一个白色单元格时,我得到更大的尺寸,但仍包含在集合视图中:->
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// handle tap events
let cell = collectionView.cellForItem(at: indexPath) as! MyCollectionViewCell
print("You selected cell #\(indexPath.item)!")
Fullscreen.originalHeight = (cell.frame.height)
Fullscreen.originalWidth = (cell.frame.width)
Fullscreen.originalX = (cell.frame.origin.x)
Fullscreen.originalY = (cell.frame.origin.y)
print(Fullscreen.originalX,Fullscreen.originalY,Fullscreen.originalWidth,Fullscreen.originalHeight)
cell.superview?.bringSubview(toFront: cell)
cell.clipsToBounds = true
UIView.animate(withDuration: 0.3,
delay: 0,
options: .curveEaseOut,
animations: {
//fullscreen
cell.frame.size.height = (collectionView.superview?.frame.height)!
cell.frame.size.width = (collectionView.superview?.frame.width)!
cell.frame.origin.x = (collectionView.superview?.frame.origin.x)!
cell.frame.origin.y = (collectionView.superview?.frame.origin.y)!
},completion: nil)
如您所见,视图被 Collectionview 的尺寸截断
我怎样才能让它弹出并具有比集合视图更大的尺寸?
我可以增加 collectionView 的 contentSize.height,但我需要水平线中的白色单元格。
谢谢
【问题讨论】:
标签: ios swift uicollectionview uicollectionviewcell uicollectionviewlayout