evgenyneu / Cosmos

A star rating control for iOS/tvOS written in Swift
MIT License
2.18k stars 366 forks source link

My image and `withTintColor` #181

Open matsotaa opened 3 years ago

matsotaa commented 3 years ago

Hello, evgenyneu Thank you for your pod) I've got some question here. I have image in png format. I'm able to change tint of it in casual UIImageView with help of .withTintColor(_:) as it expected, but when I add image to rateView.settings.filledImage or rateView.settings.emptyImage with this method nothing happens. It adds my image with origin tint color. Is that supposed to be like that or kinda bug? How can I change tint color of added image in your pod?

And one more question: Is it possible to change alignment of stars? Default statement like on left side. Can I make all stars aimed on center in my view?

Sincerely, Andrew

evgenyneu commented 3 years ago

Hi @matsota, thanks for reporting the issues.

It adds my image with origin tint color. Is that supposed to be like that or kinda bug? How can I change tint color of added image in your pod?

Yes, it's a bug in Cosmos library, there is no way to display tinted images for the stars at the moment. It has not been implemented. Cosmos does not use UIImageView, but instead draws the stars images using CALayers (see code). If we want to implements the tint, we need to update the library and do something like this.

Is it possible to change alignment of stars? Default statement like on left side. Can I make all stars aimed on center in my view?

You can use auto layout and center the cosmos view in your screen, as shown here.

matsotaa commented 3 years ago

Oh, thanks a lot)