0

你好我有一個簡單的水平唯一uicollectionview,我想彈出UICollectionViewCell。如何從UICollectionView彈出一個uicollectionViewCell?

enter image description here

當我點擊一個白色的單元格,我得到更大的尺寸,但由集查看仍包含: - > enter image description here

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,但我需要水平線上的白色單元格。

感謝

回答

1

還沒有人對你真正想要達到的目標很清楚,也許你可以分享你的代碼的某些部分,這樣我可以看到你是如何試圖實現。

只要根據您的話,您可以嘗試增加contentSize.height,就​​像您在彈出單元格時所說的一樣,並在您回到白色之前將contentSize.height放回到大小。

+0

我剛剛包括我的代碼。我想突出到灰色地帶 – masaldana2

相關問題