탭한 UICollectionView의 셀 위에만 보기 표시
                                            
                                                
                                                
                                                
                                                
                                                
                                                 5077 단어  Swift
                    
이런 느낌입니다
 
 UISlider와 CollectionView의 간단한 복습 앱 로 만든 앱에 추억으로 기능을 추가했을 뿐입니다.
 코드와 간단한 해설
CellOnView
import Foundation
import UIKit
class CellOnView{
    let cellOnView = UIView()
}
extension CellOnView{
    func createCellOnView(cellPointX:CGFloat,cellPointY:CGFloat,cellWidth:CGFloat,cellHeight:CGFloat,targetView:UIView){
        cellOnView.frame = CGRect(x: cellPointX, y: cellPointY, width: cellWidth, height:cellHeight)
        cellOnView.backgroundColor = .systemGreen
        targetView.addSubview(cellOnView)
    }
}
cellOnView.createCellOnView(~~~省略~~~,targetView:UIView)에서 UIView가 필요하기 때문에 탭 한 셀을 UIView로 selectCell에 넣습니다.ViewController
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let selectCell = collectionView.cellForItem(at: indexPath)! as UIView
        cellOnView.createCellOnView(cellPointX: selectCell.bounds.minX, cellPointY: selectCell.bounds.minY, cellWidth: selectCell.frame.size.width, cellHeight: selectCell.frame.size.height, targetView: selectCell)
    }
끝
휴식중에 생각해 보면서 해본 것에 대해 썼습니다. (유익한지는 미묘하네요)
지적이나 질문등 있으면, 기꺼이 받아들입니다.
Reference
이 문제에 관하여(탭한 UICollectionView의 셀 위에만 보기 표시), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/HiroUrata/items/ac2dfcb6c721361128df텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)