Untitled

 avatar
unknown
plain_text
5 months ago
2.2 kB
2
Indexable
{
        if collectionView == chairCLView || collectionView == collectionViewSpeaker || collectionView == sponsorCLView || collectionView == clnBroadcasterView{
            return CGSize(width: (100 * UIScreen.main.bounds.size.width) / 320, height: 145)
        } else if collectionView == collectionViewForTypes {
            let cell = collectionView.cellForItem(at: indexPath) as? NewAgendaCollectionTypesCell
            var width: CGFloat = 0.0
            if (arrOfTypes.count != 0) {
                let objModel: AgendaDetailTypesModel = arrOfTypes[indexPath.item]
                let labelText = objModel.type_name ?? ""
                let size = (Utility.initUtility()?.width(of: String(format: "%@", labelText), with:FontBoldWithSize(14.0)) ?? 0)
                cell?.lblTypeName.text = labelText
                cell?.lblTypeName.font = UIFont(name: "DMSans24pt-Bold", size: 15.0)
//                if labelFont_icon != ""{
                var rmWhiteSpace = [String]()
                var labelFont_icon = objModel.font_icon ?? ""
                if labelFont_icon != ""{
                    if labelFont_icon.contains(" "){
                        rmWhiteSpace = labelFont_icon.components(separatedBy: " ")
                        labelFont_icon = rmWhiteSpace[1]
                    }
                

                let attrString = NSMutableAttributedString(
                            string: String.fontAwesomeIcon(code: labelFont_icon) ?? "",
                            attributes: [ .font: UIFont.fontAwesome(ofSize: 16, style: .solid),.foregroundColor: Utility.getColor(objModel.font_color)])
                if attrString.length > 0 {
                    width = 20
                }
                    width += size + 36
                    
                }else {
                    width = size + 26
                }
            }
            return CGSize(width: width > 40 ? width:40, height: 30)
        }else if collectionView == clnViewForButton {
            return CGSize(width: (collectionView.frame.size.width / 4) , height: 122)
        }
        else {
            return CGSize(width: collectionView.frame.size.width / 3, height: 70)
        }
    }
Editor is loading...
Leave a Comment