Guys, tell me how to open a photo from the collection cell to the full screen, it opens for me, but the cell itself remains without resizing.

What I have already reviewed and did not understand how to apply it: https://stackoverflow.com/questions/44831301/expand-a-cell-to-full-screen-when-selected-inside-uicollectionview https://stackoverflow.com/ questions / 40346165 / how-to-expand-collectionview-cell-to-full-screen https://stackoverflow.com/questions/44831301/expand-a-cell-to-full-screen-when-selected-inside-uicollectionview

override func collectionView(_ collectionView: UICollectionView, didHighlightItemAt indexPath: IndexPath) { UIView.animate(withDuration: 0.5) { if let cell = collectionView.cellForItem(at: indexPath) as? PhotosCollectionViewCell { UIView.animate(withDuration: 1, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: { var screenSize = UIScreen.main.bounds.size let height = CGFloat(self.view.frame.size.height) let width = CGFloat(self.view.frame.size.width) cell.photo?.frame = CGRect(x: 0, y: 0, width: 1000, height: 1000) cell.photo?.bounds = CGRect(x: 0, y: 0, width: 1000, height: 1000) }) cell.photo?.transform = .init(scaleX: 0.50, y: 0.50) cell.contentView.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1) } } } 

all that I could dig on the Internet

  • When you click a user (if I understand the task correctly), you need to create a new UIImageView (or UIView, and put a UIImageView on it) and add it to the screen (self.view). In it and display the picture. You should start by handling the click on the photo in the CollectionView. - Ivan Kramarchuk

0