Cosmos
Cosmos copied to clipboard
Is there a way to make star size fit the size of the view?
So it can be adjusted to different device screens. Thanks!
Hi @acecilia, no, unfortunately the star sizes are not adjusted to the size of the cosmos view at the moment. It works the other way around, you set the size of a single star and the view adjusts its size to that. It works similar to a UILabel where you adjust the font size.
cosmosView.settings.starSize = 30
But I realize that the auto-size mode can be handy, thank you for the idea. I will think how it can be done.
Hi, has this been fixed yet?
Hi @TPAD, no, unfortunately, the auto-size feature has not been implemented yet.
@TPAD you can get a similar behavior by setting an aspect ratio constraint to it
@acecilia I'd like to know how that works? Setting an aspect ratio constraint to the CosmosView doesn't make the stars grow when the View grows.
+1
@tiuya @siideffect sorry, just saw this. Its been a long time I stopped working with this code and I do not remember how I finally managed.
Actually, I am using this method, and I would be happy to share it with you:
let countStars = 5
ratingbar.starMargin = 2
ratingbar.starSize = (ratingbar.frame.width/countStars)-(ratingbar.starMargin) //star size gonna stretch with the width of the ratingbar
This feature would be a very useful and actually necessary addition.