LinkedInAttic / LayoutKit

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
http://layoutkit.org
Apache License 2.0
3.16k stars 267 forks source link

Using Custom UIControll callback event & flickery issue #171

Open siam-biswas opened 7 years ago

siam-biswas commented 7 years ago

I'm using layoutKit with UICollectionView. Using a custom UIControll object with SizeLayout in specific Cell causing weird behavior.

  let reaction =  SizeLayout<ReactionButton>(
        height: 40,
        viewReuseId: "reaction",
        config: { reactionButton in

                reactionButton.reactionSelector = ReactionSelector()

                reactionButton.config = ReactionButtonConfig() {
                    $0.iconMarging      = 8
                    $0.spacing          = 6
                    $0.alignment        = .centerLeft
                }

                reactionButton.reaction = content.reaction

                if let selector = content.reactionSelector{
                    reactionButton.addTarget(content.target, action: selector, for: .valueChanged)
                    reactionButton.addTarget(content.target, action: selector, for: .touchUpInside)
                }

    })

.ValueChangeD and .TouchUpInside event gets called multiple times in different indexes for a Single Press event. And also there is a flickery issue exist while scrolling if I generate the cell layout with this custom UIControll.