Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 与标题重叠的不可复制集合视图单元格[Swift]_Ios_Swift_Uicollectionview_Uicollectionviewcell - Fatal编程技术网

Ios 与标题重叠的不可复制集合视图单元格[Swift]

Ios 与标题重叠的不可复制集合视图单元格[Swift],ios,swift,uicollectionview,uicollectionviewcell,Ios,Swift,Uicollectionview,Uicollectionviewcell,如标题所述,实际上我对水龙头区域有问题。我所做的是使用自定义UICollectionViewFlowLayout中的SectionInset将单元格与标题重叠,使其看起来如图所示 问题是,正如你看到的红圈和绿圈一样,它表示不能点击,也可以点击。我搜索了一整天,但没有找到答案 有什么我错过的吗 单元格在ViewDidLoad中插入代码: let layout: FlowLayoutProperty = FlowLayoutProperty.init(itemSize: CGSize.zero, m

如标题所述,实际上我对水龙头区域有问题。我所做的是使用自定义
UICollectionViewFlowLayout
中的
SectionInset
将单元格与标题重叠,使其看起来如图所示

问题是,正如你看到的红圈和绿圈一样,它表示不能点击,也可以点击。我搜索了一整天,但没有找到答案

有什么我错过的吗

单元格在
ViewDidLoad
中插入代码:

let layout: FlowLayoutProperty = FlowLayoutProperty.init(itemSize: CGSize.zero, minimumInteritemSpacing: 10, minimumLineSpacing: 10)
        layout.scrollDirection = UICollectionView.ScrollDirection.vertical
        layout.sectionInset = UIEdgeInsets.init(top: -50, left: 10, bottom: 10, right: 10)
标题代码为:

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
    
    //header height size, refer headerreferencesize
    
    switch kind {
        case UICollectionView.elementKindSectionHeader:
            
            guard let headerView: V4UMGCMainHeader = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "V4UMGCMainHeaderWeather", for: indexPath) as? V4UMGCMainHeader else {
                fatalError("Header not found")
            }
            
            self.headerView = headerView
            
            let dFormat: DateFormatter = DateFormatter.init()
            dFormat.dateFormat = "EE, dd MMM"
            headerView.lblUMGCWDate.text = dFormat.string(from: Date.init())
            
            headerView.btnUMGCWAddMember.transformToContentStandard()
            headerView.btnUMGCWAddMember.titleLabel?.font = FontPredefine.MuliMedium(withSize: 12.0)
            headerView.btnUMGCWAddMember.backgroundColor = UIColor.hexStringToUIColor(hex: "#C18845")
            headerView.btnUMGCWAddMember.addTarget(self, action: #selector(self.checkMemberShipHeader(sender:)), for: UIControl.Event.touchUpInside)
            
            headerView.lblUMGCWLocation.text = "Point Location"
            
            if(KeychainedLoginCache.loadClubMemberInfo()[.ClubHouseID]! == nil && self.menuType == MenuType.UserMode)
            {
                //if clubmember not available
                headerView.btnUMGCWAddMember.setTitle(AppDelegate.getLocalString(forKey: "UMGCVC_CLUBHEADER_ADDMEMBER_BTN"), for: UIControl.State.normal)
                headerView.btnUMGCWAddMember.isEnabled = true
                headerView.lcUMGCWAddMemberHeight.constant = 40
                self.headerLayoutProperty?.sectionInset = UIEdgeInsets.init(top: -50, left: 10, bottom: 10, right: 10)
            }
            else
            {
                //if clubmember available
                headerView.btnUMGCWAddMember.setTitle("", for: UIControl.State.normal)
                headerView.btnUMGCWAddMember.isEnabled = false
                headerView.lcUMGCWAddMemberHeight.constant = 0
                self.headerLayoutProperty?.sectionInset = UIEdgeInsets.init(top: -90, left: 10, bottom: 10, right: 10)
            }
       
            
        return headerView
        
    default:
        assert(false, "error")
        
    }
    return V4UMGCMainHeader.init()
}

好吧,我觉得这真的很棘手。我应该把
zIndex
放在
UICollectionViewFlowLayout
layouttributesforements
layouttributesforeitem
下,现在它可以工作了