Closed Lokeshkumar0066 closed 1 year ago
tagViewCollection.delegate = self tagViewCollection.scrollDirection = .horizontal tagViewCollection.alignment = .fillByExpandingWidth tagViewCollection.numberOfLines = 2 tagViewCollection.scrollView.showsHorizontalScrollIndicator = false tagViewCollection.horizontalSpacing = 20 tagViewCollection.verticalSpacing = 20 tagViewCollection.contentInset = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 0)
func generateTagData() { var tagData: [TTGTextTag] = [] self.tagViewCollection.removeAllTags() let data = homeVWmodel.textConcepts for dict in data { let imageText = dict.capitalized let replaceOcc = imageText.replacingOccurrences(of: "\n", with: " ") let width = replaceOcc.textWidth(font: UIFont(name: AppFonts.bold, size: 14)!) + 0 let content = TTGTextTagStringContent(text: replaceOcc, textFont: UIFont(name: AppFonts.bold, size: 14.0), textColor: UIColor(named:"CCFFDE")!) let style = TTGTextTagStyle() style.borderWidth = 2.0 style.exactHeight = 38 style.cornerRadius = 8.0 style.exactWidth = width style.borderColor = UIColor(named:"CCFFDE")! style.backgroundColor = .clear style.shadowColor = .clear let textTag = TTGTextTag(content: content, style: style) textTag.selectedStyle?.backgroundColor = .clear tagData.append(textTag) } if tagData.count > 0 { self.tagViewCollection.add(tagData) } }