evgenyneu / Cosmos

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

How to set empty image for empty start(non partially filled as well) #180

Closed Karthikmoback closed 3 years ago

Karthikmoback commented 3 years ago

I was able to set the start with decimal precise to show the star with partially filled of stars, But empty image is set to partially filled star , which i dont want to happen. Need to show like this

Screenshot 2021-01-18 at 2 59 53 PM

Instead of this IMG_6C0E5D923EC4-1

evgenyneu commented 3 years ago

Hi @Karthikmoback, do you use custom star images?

Karthikmoback commented 3 years ago

@evgenyneu yes, here is my settings in storyboard and changing mode to precise in code when necessary. ratingView.settings.fillMode = .precise

Screenshot 2021-01-18 at 4 04 15 PM
evgenyneu commented 3 years ago

Oh, I see your "empty" image has the black border. Did you try without setting the "empty" image? Or maybe use an empty image which is blank/transparent?

Karthikmoback commented 3 years ago

what i want is to set the empty image with border to only for those star which is empty, but not partially filled.

evgenyneu commented 3 years ago

@Karthikmoback hmmm I'm not sure this is possible with Cosmos. It simply draws "filled" image on top of "empty" one. And when a star is partially filled it just draws a part of "filled" but it still draws entire "empty" image. So it will always draw the border for your images.

Karthikmoback commented 3 years ago

@evgenyneu thanks for the support. I made use of empty image border with same color of fill color, to make to look good.