Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set unselected reaction? #17

Open
alizainprasla opened this issue Nov 18, 2017 · 0 comments
Open

How to set unselected reaction? #17

alizainprasla opened this issue Nov 18, 2017 · 0 comments

Comments

@alizainprasla
Copy link

alizainprasla commented Nov 18, 2017

How to set unselected reaction once iboutlet did set?

i am using pod 'Reactions', '~> 1.1.1'

My first item selected reaction is a grey color. Just like its working on facebook reaction

@IBOutlet weak var reactionnButton: ReactionButton! {
        didSet {

            let select = ReactionSelector()
            let reactionLike =      Reaction(id: "id", title: "Like", color: .red, icon: #imageLiteral(resourceName: "like"))
            let reactionAngry =     Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "emoji_angry"))
            let reactionEnvy =      Reaction(id: "id", title: "Envy", color: .red, icon: #imageLiteral(resourceName: "emoji_envy"))
            let reactionLove =      Reaction(id: "id", title: "Love", color: .red, icon: #imageLiteral(resourceName: "emoji_love"))
            let reactionSick =      Reaction(id: "id", title: "Sick", color: .red, icon: #imageLiteral(resourceName: "emoji_sick"))
            let reactionHappy =     Reaction(id: "id", title: "Happy", color: .red, icon: #imageLiteral(resourceName: "emoji_happy"))
            let reactionCrying =    Reaction(id: "id", title: "Crying", color: .red, icon: #imageLiteral(resourceName: "emoji_crying"))
            
            select.reactions = [
                reactionLike,
                reactionAngry,
                reactionEnvy,
                reactionLove,
                reactionSick,
                reactionHappy,
                reactionCrying
            ]
            
            //select.reactions = Reaction.facebook.all
            
            //select.selectedReaction = Reaction(id: "id", title: "Angry", color: .red, icon: #imageLiteral(resourceName: "like-template"))
            
            reactionnButton.reactionSelector = select
            reactionnButton.config           = ReactionButtonConfig() {
                $0.iconMarging      = 15
                $0.spacing          = 5
                $0.font             = UIFont(name: "ApexRounded-Book", size: 14)
                $0.neutralTintColor = UIColor(red: 0.47, green: 0.47, blue: 0.47, alpha: 1)
                $0.alignment        = .centerLeft
            }
            
            
            
            reactionnButton.reactionSelector?.feedbackDelegate = self
            
            // This one takes a value from ReactionSelector
            reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .valueChanged)
            // And this one from ReactionButton
            reactionnButton.addTarget(self, action: #selector(reactionChanged), for: .touchUpInside)
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant