janselv / fave-button

FaveButton is an iOS cute animated like button written in Swift.
MIT License
1.51k stars 201 forks source link

Using a different image at the end of the animation #22

Open ugur10 opened 7 years ago

ugur10 commented 7 years ago

Hi,

Great library, congrats πŸ‘

With a white bordered empty icon, I want the result to become filled with color. Another option is a completely different image (i.e. white bordered as "default", filled image as "selected"). As an example, I think the heart button in Instagram fits in our case.

How can we achieve this?

Best,

Ugur

martihag commented 7 years ago

Hey, I added this functionality on my fork. I'll look into preparing a PR once the maintainer returns. https://github.com/martihag/fave-button

You can set up Cocoapods to point to a specific commit on a different fork.

ugur10 commented 7 years ago

You are awesome! I just checked it out, looks super cool! Thank you! =}

ugur10 commented 7 years ago

Martin, I have a question.

I used a star line icon with a yellow filled star.

Star ended up being completely red like the heart icon. Why is this?

martihag commented 7 years ago

For your assets, make sure they render as template. In Interface Builder, make sure to set the same color for selected and normal. And of course also set a selected image (just added).

If you have done all this I am not sure whatΒ΄s wrong.

ugur10 commented 7 years ago
screen shot 2017-05-27 at 15 59 53 screen shot 2017-05-27 at 16 00 17

First one, the heart image. Just like your in the demo.

The second, is the star. I had to pick yellow to make it like this.

I am very very thankful. But for an image with colors more than one, I think there might be a problem. For the Selected Color attribute, I believe the default is red, so for the heart there is no problem. But for a final image, if the color is only one and different than that red color, you have to pick on the storyboard.

For the image with many colors etc., like I said, we may need to add something more.

Thank you so much!

martihag commented 7 years ago

Oh yeah, the default red color can be confusing, and both colors needs to be set explicitly. It looks correct on your second one. You got it solved for now then?

AlbertoLourenco commented 7 years ago

Thanks @martihag ! πŸ‘

stakada7 commented 6 years ago

πŸŽ‰

moetanahy commented 3 years ago

Hi @janselv - thanks for the library - it looks great. I'd love to have this feature implemented within the Fave button library. Is there any chance this will be integrated soon?

@martihag thanks for sharing your fork - I'd love to use it, but it's not compatible with Swift 5 I believe (some issues with renaming NSLayoutConstraints I believe).