TTGTagCollectionView icon indicating copy to clipboard operation
TTGTagCollectionView copied to clipboard

selectedContent text color is reset to black

Open 70m3n opened this issue 3 years ago • 3 comments

I set different background colors and text colors for normal content/style and selected content/style. Background colors always display correct, but the text color is reset when scrolling a tableView with a TTGTextTagCollectionView for each cell. So when the cell re-renders in cellForRowAt, the text color is almost always black. I set it to be white on selected tags.

70m3n avatar Sep 07 '21 08:09 70m3n

@70m3n Can you provide some Demo code ? Thank you.

zekunyan avatar Sep 08 '21 02:09 zekunyan

It's hard to provide any demo code, because the app I'm working on has some fairly complex UI. That may also be the source of my problem. I did however make a sample app, with only one view controller with a table view, listing tags in several sections, thus rendering n number of TTGTextTagCollectionViews. That worked fine.

After som debugging in the app I'm working on I found that the text color in TTGTextTagStringContent wasn't reset back to the normal color I set (dark gray). It was reset back to black, which I'm not sure where comes from.

I'm not sure what causes the problem, if it is my code or the code in the package, or even a combination. Life cycle events. Race conditions. I'm out of options.

Thanks for your time, though.

I attached an image showing the problem in action.

Simulator Screen Shot - iPhone 12 mini - 2021-09-09 at 13 55 12

70m3n avatar Sep 09 '21 11:09 70m3n

I had the same issue I didn't notice that you can set content and selectedContent separately for a tag leaving this here for anyone in the future let tag = TTGTextTag.init() tag.content = content tag.selectedContent = selectedContent

Ahmed-Masoud avatar Oct 04 '21 18:10 Ahmed-Masoud