You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
our App includes the TTGTagCollectionView. We are fetching user data from our backend. For this example "extras" which are selected for an object. And after that we are "searching" and "selecting" the tags which belongs the "id" from that one element which returned from our backend. This worked every time fine and we don't changed anything in this function.
What we have checked:
Does our backend retrive the correct data? --> YES
Does the update tag Method from the TTGTextTagCollection reacting to the call and change the color for that one tag? --> NO
Does the Pod have any new updates in recent time? - YES
Updated ? currently on Version 2.4.1--> YES
Here you can see some code instructions from us how we are iterate for each data and update the tag on that specific tag index position. But the tags still stay on our default "Gray" Color:
This function builds all available tags in our collection view. So that means we are building a TAG for each available data entry which is selectable:
This function is called after we are retrive the "already" selected options from the user. That function is gonna used to iterate for every selected data:
`
func searchAndSelectProductExtraTags() {
self.selectedCardExtras.forEach { selectedCardExtra in
// Define and get the correct index for our area which we are sarching
let indexForKey = getIndexForSelectedCardExtra(forKey: selectedCardExtra.key)
// We detected an element which is selected
let itemPrice = String(format: "%.2f", selectedCardExtra.price).replacingOccurrences(of: ".", with: ",") + " €"
let textForTag = selectedCardExtra.name + " - " + itemPrice
let content = TTGTextTagStringContent.init(text: textForTag)
content.textColor = UIColor.white
content.textFont = UIFont(name: "Poppins-Regular", size: 15)!
let normalStyle = TTGTextTagStyle.init()
normalStyle.backgroundColor = CustomColor.lightGray
normalStyle.cornerRadius = 25
normalStyle.borderColor = .clear
normalStyle.extraSpace = CGSize.init(width: 20, height: 20)
let selectedStyle = TTGTextTagStyle.init()
selectedStyle.backgroundColor = CustomColor.orange
selectedStyle.cornerRadius = 25
selectedStyle.borderColor = .clear
selectedStyle.extraSpace = CGSize.init(width: 20, height: 20)
let newTag = TTGTextTag.init()
newTag.selected = true
newTag.content = content
newTag.style = normalStyle
newTag.selectedStyle = selectedStyle
// Update the area tag on that position which returned from the fetched area array
productExtraSelectorCollectionView.updateTag(at: UInt(indexForKey), withNewTag: newTag)
}
}`
So something is happening here because as I said above this method worked really fine. We also have compared our versions and the currently stable version works fine. The new version which we are currently developing are not working fine anymore. We don't have any changes at this point.
Please provide us an Instruction what we are doing wrong and could do better.
Best regards
The text was updated successfully, but these errors were encountered:
So after debugging for like 2 Hours I got an Idea to "getAllSelectedTags" from the Collection. And whoala the tags which are updated before with the "selectedContent" are there. So the implementation above works fine as like before. The only problem is that the state doesn't change.
So I have tried some more things until I found out that the "updateTag" Method does not change the state instantly anymore. So the solution at this point was only to call "tagCollectionView.reload()" at the and of the loops 😄. So easy.
I think the Issue could be closed at this point. But maybe the creator of this beautiful library want to give a look at the "updateTag" - Method if there are some more changes made which could effect some other points.
Hey,
our App includes the TTGTagCollectionView. We are fetching user data from our backend. For this example "extras" which are selected for an object. And after that we are "searching" and "selecting" the tags which belongs the "id" from that one element which returned from our backend. This worked every time fine and we don't changed anything in this function.
What we have checked:
Here you can see some code instructions from us how we are iterate for each data and update the tag on that specific tag index position. But the tags still stay on our default "Gray" Color:
`
func buildTagsForProductExtras() {
`
func searchAndSelectProductExtraTags() {
So something is happening here because as I said above this method worked really fine. We also have compared our versions and the currently stable version works fine. The new version which we are currently developing are not working fine anymore. We don't have any changes at this point.
Please provide us an Instruction what we are doing wrong and could do better.
Best regards
The text was updated successfully, but these errors were encountered: